QmlDesigner: Fix model sync on property remove

Removing the name property of a state in the TextEditor was not
triggering a model rest, which caused the StateEditor being in a wrong
state.

Change-Id: I1bd43f5f6bfb962e4a838cbd74c37c7ed4e37d9c
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Henning Gruendl
2022-09-23 16:14:22 +02:00
committed by Henning Gründl
parent d920139302
commit 5582a8047a

View File

@@ -719,7 +719,7 @@ void StatesEditorView::propertiesRemoved(const QList<AbstractProperty>& property
for (const AbstractProperty &property : propertyList) {
if (property.name() == "states" && property.parentModelNode() == activeStateGroup().modelNode())
resetModel();
if (property.name() == "when"
if ((property.name() == "when" || property.name() == "name")
&& QmlModelState::isValidQmlModelState(property.parentModelNode()))
resetModel();
if (property.name() == "extend")
@@ -847,7 +847,8 @@ void StatesEditorView::variantPropertiesChanged(const QList<VariantProperty> &pr
auto guard = qScopeGuard([&]() { m_block = false; });
for (const VariantProperty &property : propertyList) {
if (property.name() == "name" && QmlModelState::isValidQmlModelState(property.parentModelNode()))
if (property.name() == "name"
&& QmlModelState::isValidQmlModelState(property.parentModelNode()))
resetModel();
else if (property.name() == "state"
&& property.parentModelNode() == activeStateGroup().modelNode())