diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/ComboBox.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/ComboBox.qml index f83e985ea9a60fc835c3574d9ca822fccab1627a..8ed536857216b7915a8913be43cbca2770f27aa0 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/ComboBox.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/ComboBox.qml @@ -49,6 +49,18 @@ QWidget { id: box property var backendValue: comboBox.backendValue 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 { backendValue: comboBox.backendValue; y: 3 diff --git a/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp b/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp index 67d27b5a1ba4f97ec4e70ac485ec4e3bbb314b8a..bb3917cdf17e08966780cd0e78d5c6aecba688e9 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp @@ -808,6 +808,18 @@ public slots: 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: void currentTextChanged(); void itemsChanged(); @@ -817,8 +829,10 @@ private: { _items = list; cb->clear(); + blockSignals(true); cb->addItems(list); m_itemsSet = true; + blockSignals(false); emit itemsChanged(); }