diff --git a/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp index 8acd5abca28..4ea4e948091 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp @@ -37,6 +37,8 @@ #include +#include + using namespace QmlDesigner; static const int propertyNameRole = Qt::UserRole + 1; @@ -315,12 +317,21 @@ void DynamicPropertyRow::setupBackendValue() void DynamicPropertyRow::commitValue(const QVariant &value) { + if (m_lock) + return; + + if (m_row < 0) + return; + auto propertiesModel = m_model->dynamicPropertiesModel(); VariantProperty variantProperty = propertiesModel->variantPropertyForRow(m_row); if (!Internal::DynamicPropertiesModel::isValueType(variantProperty.dynamicTypeName())) return; + m_lock = true; + auto unlock = qScopeGuard([this] { m_lock = false; }); + auto view = propertiesModel->view(); RewriterTransaction transaction = view->beginRewriterTransaction( QByteArrayLiteral("DynamicPropertiesModel::commitValue")); @@ -335,6 +346,15 @@ void DynamicPropertyRow::commitValue(const QVariant &value) void DynamicPropertyRow::commitExpression(const QString &expression) { + if (m_lock) + return; + + if (m_row < 0) + return; + + m_lock = true; + auto unlock = qScopeGuard([this] { m_lock = false; }); + auto propertiesModel = m_model->dynamicPropertiesModel(); BindingProperty bindingProperty = propertiesModel->bindingPropertyForRow(m_row); diff --git a/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.h b/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.h index c347e310de4..0d11fe8f3f2 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.h +++ b/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.h @@ -105,6 +105,7 @@ private: PropertyEditorValue *m_backendValue = nullptr; DynamicPropertiesProxyModel *m_model = nullptr; QList m_proxyBackendValues; + bool m_lock = false; }; QML_DECLARE_TYPE(DynamicPropertyRow)