diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ComboBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ComboBox.qml index dfc408f5e2fcb186deeaa2ec1e094af8a1531ff6..2c90e1b73e32feaa9690084849db3836bd9e0843 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ComboBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ComboBox.qml @@ -41,33 +41,53 @@ Controls.ComboBox { property bool useInteger: false + property bool __isCompleted: false + ColorLogic { id: colorLogic backendValue: comboBox.backendValue onValueFromBackendChanged: { - if (!comboBox.useInt) { + invalidate(); + } + + function invalidate() { + if (!comboBox.useInteger) { var enumString = comboBox.backendValue.enumeration; + if (enumString === "") enumString = comboBox.backendValue.value - comboBox.currentIndex = comboBox.find(enumString); + + var index = comboBox.find(enumString) + + if (index !== comboBox.currentIndex) + comboBox.currentIndex = comboBox.find(enumString) + } else { - comboBox.currentIndex = backendValue.value + if (comboBox.currentIndex !== backendValue.value) + comboBox.currentIndex = backendValue.value } } } onCurrentTextChanged: { + if (!__isCompleted) + return; + if (backendValue === undefined) return; - if (!comboBox.useInt) { + if (!comboBox.useInteger) { backendValue.setEnumeration(comboBox.scope, comboBox.currentText); } else { - print("useint" + comboBox.currentIndex) backendValue.value = comboBox.currentIndex; } } + Component.onCompleted: { + colorLogic.invalidate() + __isCompleted = true; + } + style: CustomComboBoxStyle { textColor: comboBox.textColor }