aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Gruendl <henning.gruendl@qt.io>2022-05-17 15:17:06 +0200
committerHenning Gründl <henning.gruendl@qt.io>2022-05-17 14:09:46 +0000
commite865b03448a0c465e55fbfe318c9ac8e19e6663e (patch)
tree778440cda38a3a4b3ed1ec363400078d231b72f3
parent87a7d94629a2a0aae5dcae4df7a68bed9f621977 (diff)
QmlDesigner: Fix bound properties change behavior
Changing a bound property was triggering a value change twice. Once with the previous value and another time with the newly set value. This was solved by locking the binding property change emit with a scope lock. Change-Id: I9605269e911f0468b2d52d74ad8a2a43f907a18c Reviewed-by: Marco Bubke <marco.bubke@qt.io>
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp
index fb1baed3f3..d0f8dd7043 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp
@@ -256,6 +256,9 @@ void PropertyEditorView::changeExpression(const QString &propertyName)
if (noValidSelection())
return;
+ QScopeGuard unlock([&](){ m_locked = false; });
+ m_locked = true;
+
executeInTransaction("PropertyEditorView::changeExpression", [this, name](){
PropertyName underscoreName(name);
underscoreName.replace('.', '_');
@@ -317,9 +320,9 @@ void PropertyEditorView::changeExpression(const QString &propertyName)
return;
}
- if (qmlObjectNode->expression(name) != value->expression() || !qmlObjectNode->propertyAffectedByCurrentState(name))
+ if (qmlObjectNode->expression(name) != value->expression()
+ || !qmlObjectNode->propertyAffectedByCurrentState(name))
qmlObjectNode->setBindingProperty(name, value->expression());
-
}); /* end of transaction */
}
@@ -692,6 +695,9 @@ void PropertyEditorView::variantPropertiesChanged(const QList<VariantProperty>&
void PropertyEditorView::bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags /*propertyChange*/)
{
+ if (locked())
+ return;
+
if (noValidSelection())
return;