From 9f0d5d58663ddcfe70177b276d62e65ce64ced11 Mon Sep 17 00:00:00 2001
From: Thomas Hartmann <Thomas.Hartmann@nokia.com>
Date: Wed, 7 Apr 2010 14:27:18 +0200
Subject: [PATCH] QmlDesigner.propertyEditor: fix ComboBox.qml

---
 .../qmldesigner/propertyeditor/Qt/ComboBox.qml     | 12 ++++++++++++
 .../components/propertyeditor/basicwidgets.cpp     | 14 ++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/ComboBox.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/ComboBox.qml
index f83e985ea9a..8ed53685721 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 67d27b5a1ba..bb3917cdf17 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();
     }
 
-- 
GitLab