Commit f7985a2e authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

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
parent 600ed1eb
......@@ -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());
}
......
......@@ -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);
......
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