Commit 6d10a6f0 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner: Improve Go To Component

This improves the signals present in "Go To Component"
or "Add Signal Handler".
For some controls we have to offer property changed signal
handler as first options.
We simply hard code properties which are likely to be handled.

Change-Id: Ide26589534d6d058f1b60afcc6353c4f0340cb22
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent 0a340911
......@@ -55,6 +55,21 @@ QString AddSignalHandlerDialog::signal() const
return m_signal;
}
bool checkForPropertyChanges(const QString &signal)
{
static const QStringList importantProperties = {"pressed","position","value",
"checked","currentIndex","index",
"text","currentText", "currentItem"};
if (!signal.endsWith("Changed"))
return true;
QString property = signal;
property.chop(7);
/* Some important property changes we keep */
return importantProperties.contains(property);
}
void AddSignalHandlerDialog::updateComboBox()
{
m_ui->comboBox->clear();
......@@ -62,12 +77,10 @@ void AddSignalHandlerDialog::updateComboBox()
if (m_ui->all->isChecked()) {
m_ui->comboBox->addItem(signal);
} else if (m_ui->properties->isChecked()) {
if (signal.contains(QLatin1String("Changed")))
m_ui->comboBox->addItem(signal);
} else {
if (!signal.contains(QLatin1String("Changed")))
if (signal.endsWith("Changed"))
m_ui->comboBox->addItem(signal);
}
} else if (checkForPropertyChanges(signal))
m_ui->comboBox->addItem(signal);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment