Commit 9f0d5d58 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.propertyEditor: fix ComboBox.qml

parent a295ec49
...@@ -49,6 +49,18 @@ QWidget { ...@@ -49,6 +49,18 @@ QWidget {
id: box id: box
property var backendValue: comboBox.backendValue property var backendValue: comboBox.backendValue
onCurrentTextChanged: { backendValue.value = currentText; evaluate(); } onCurrentTextChanged: { backendValue.value = currentText; evaluate(); }
onItemsChanged: {
if (comboBox.backendValue.value == curentText)
return;
box.setCurrentTextSilent(comboBox.backendValue.value);
}
property var backendValueValue: comboBox.backendValue.value
onBackendValueValueChanged: {
if (comboBox.backendValue.value == curentText)
return;
box.setCurrentTextSilent(comboBox.backendValue.value);
}
ExtendedFunctionButton { ExtendedFunctionButton {
backendValue: comboBox.backendValue; backendValue: comboBox.backendValue;
y: 3 y: 3
......
...@@ -808,6 +808,18 @@ public slots: ...@@ -808,6 +808,18 @@ public slots:
emit currentTextChanged(); emit currentTextChanged();
} }
} }
public slots:
void setCurrentTextSilent(const QString &text)
{
if (!m_itemsSet)
return;
int i = cb->findText(text);
if (i != -1) {
blockSignals(true);
cb->setCurrentIndex(i);
blockSignals(false);
}
}
signals: signals:
void currentTextChanged(); void currentTextChanged();
void itemsChanged(); void itemsChanged();
...@@ -817,8 +829,10 @@ private: ...@@ -817,8 +829,10 @@ private:
{ {
_items = list; _items = list;
cb->clear(); cb->clear();
blockSignals(true);
cb->addItems(list); cb->addItems(list);
m_itemsSet = true; m_itemsSet = true;
blockSignals(false);
emit itemsChanged(); emit itemsChanged();
} }
......
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