QmlDesigner: Fix state shown after reordering

Fix an issue which caused the wrong state to be shown in the form editor
after reordering the states in the state editor.

Task-number: QDS-7753
Change-Id: I220bb5b11beb4f9bfc6a85069a688c9ff2984d8f
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Henning Gruendl
2022-09-22 17:43:15 +02:00
committed by Henning Gründl
parent e28810b50c
commit 754be28e36
2 changed files with 20 additions and 0 deletions

View File

@@ -118,5 +118,21 @@ bool QmlStateNodeInstance::resetStateProperty(const ObjectNodeInstance::Pointer
return QmlPrivateGate::States::resetStateProperty(object(), target->object(), propertyName, resetValue);
}
void QmlStateNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParentInstance,
const PropertyName &oldParentProperty,
const ObjectNodeInstance::Pointer &newParentInstance,
const PropertyName &newParentProperty)
{
ServerNodeInstance oldState = nodeInstanceServer()->activeStateInstance();
ObjectNodeInstance::reparent(oldParentInstance,
oldParentProperty,
newParentInstance,
newParentProperty);
if (oldState.isValid())
oldState.activateState();
}
} // namespace Internal
} // namespace QmlDesigner

View File

@@ -49,6 +49,10 @@ public:
bool updateStateBinding(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QString &expression) override;
bool resetStateProperty(const ObjectNodeInstance::Pointer &target, const PropertyName &propertyName, const QVariant &resetValue) override;
void reparent(const ObjectNodeInstance::Pointer &oldParentInstance,
const PropertyName &oldParentProperty,
const ObjectNodeInstance::Pointer &newParentInstance,
const PropertyName &newParentProperty) override;
protected:
QmlStateNodeInstance(QObject *object);