From f7985a2ea86f358928b23f19fa5263efb438f177 Mon Sep 17 00:00:00 2001
From: Thomas Hartmann <Thomas.Hartmann@nokia.com>
Date: Wed, 21 Apr 2010 14:49:49 +0200
Subject: [PATCH] QmlDesigner.propertyEditor: fix notification singals for

This patch fixes the notification signals for PropertyEditorValue
There a two different signals now for the qml part and the backend
This avoids subtle bugs
---
 .../components/propertyeditor/propertyeditorvalue.cpp | 11 +++++++----
 .../components/propertyeditor/propertyeditorvalue.h   |  7 ++++---
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
index 8c59304303c..2375e494411 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
@@ -109,6 +109,7 @@ void PropertyEditorValue::setValueWithEmit(const QVariant &value)
         setValue(newValue);
         m_isBound = false;
         emit valueChanged(name(), value);
+        emit valueChangedQml();
         emit isBoundChanged();
     }
 }
@@ -121,7 +122,8 @@ void PropertyEditorValue::setValue(const QVariant &value)
 
         m_value = value;
 
-    emit valueChanged(QString(), value);
+    if (m_value.isValid())
+        emit valueChangedQml();
     emit isBoundChanged();
 
 }
@@ -156,7 +158,8 @@ bool PropertyEditorValue::isInSubState() const
 
 bool PropertyEditorValue::isBound() const
 {
-    return modelNode().isValid() && modelNode().property(name()).isValid() && modelNode().property(name()).isBindingProperty();
+    const QmlDesigner::QmlObjectNode objectNode(modelNode());
+    return objectNode.isValid() && objectNode.hasBindingProperty(name());
 }
 
 bool PropertyEditorValue::isInModel() const
@@ -206,8 +209,8 @@ PropertyEditorNodeWrapper* PropertyEditorValue::complexNode()
 
 void PropertyEditorValue::resetValue()
 {
-    if (m_value.isValid()) {
-        setValue(QVariant());
+    if (m_value.isValid() || isBound()) {
+        m_value = QVariant();
         m_isBound = false;
         emit valueChanged(name(), QVariant());
     }
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h
index 9a81e17f25e..1a6c42e872c 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h
@@ -80,10 +80,10 @@ private:
 class PropertyEditorValue : public QObject
 {
     Q_OBJECT
-    Q_PROPERTY(QVariant value READ value WRITE setValueWithEmit NOTIFY valueChanged)
+    Q_PROPERTY(QVariant value READ value WRITE setValueWithEmit NOTIFY valueChangedQml)
     Q_PROPERTY(QString expression READ expression WRITE setExpressionWithEmit NOTIFY expressionChanged FINAL)
-    Q_PROPERTY(bool isInModel READ isInModel NOTIFY valueChanged FINAL)
-    Q_PROPERTY(bool isInSubState READ isInSubState NOTIFY valueChanged FINAL)
+    Q_PROPERTY(bool isInModel READ isInModel NOTIFY valueChangedQml FINAL)
+    Q_PROPERTY(bool isInSubState READ isInSubState NOTIFY valueChangedQml FINAL)
     Q_PROPERTY(bool isBound READ isBound NOTIFY isBoundChanged FINAL)
     Q_PROPERTY(bool isValid READ isValid NOTIFY isValid FINAL)
     Q_PROPERTY(QString name READ name FINAL)
@@ -124,6 +124,7 @@ public slots:
 
 signals:
     void valueChanged(const QString &name, const QVariant&);
+    void valueChangedQml();
 
     void expressionChanged(const QString &name);
 
-- 
GitLab