From e865b03448a0c465e55fbfe318c9ac8e19e6663e Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Tue, 17 May 2022 15:17:06 +0200 Subject: [PATCH] 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 --- .../components/propertyeditor/propertyeditorview.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp index fb1baed3f36..d0f8dd70435 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& void PropertyEditorView::bindingPropertiesChanged(const QList& propertyList, PropertyChangeFlags /*propertyChange*/) { + if (locked()) + return; + if (noValidSelection()) return;