QmlDesigner: Make DynamicPropertyRow::commitValue state aware

Change-Id: I2f6d93be6fe1f92637902138ac9f073f18f1af22
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Thomas Hartmann
2022-09-09 16:32:38 +02:00
parent af0728e530
commit 0192cef3bb

View File

@@ -336,8 +336,16 @@ void DynamicPropertyRow::commitValue(const QVariant &value)
RewriterTransaction transaction = view->beginRewriterTransaction(
QByteArrayLiteral("DynamicPropertiesModel::commitValue"));
try {
if (view->currentState().isBaseState()) {
if (variantProperty.value() != value)
variantProperty.setDynamicTypeNameAndValue(variantProperty.dynamicTypeName(), value);
} else {
QmlObjectNode objectNode = variantProperty.parentQmlObjectNode();
QTC_CHECK(objectNode.isValid());
PropertyName name = variantProperty.name();
if (objectNode.isValid() && objectNode.modelValue(name) != value)
objectNode.setVariantProperty(name, value);
}
transaction.commit(); //committing in the try block
} catch (Exception &e) {
e.showException();