diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlstatenodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlstatenodeinstance.cpp index 5b320814594..c07cc4bfcff 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlstatenodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qmlstatenodeinstance.cpp @@ -25,10 +25,11 @@ #include "qmlstatenodeinstance.h" -#include - #include "qmlpropertychangesnodeinstance.h" +#include +#include + namespace QmlDesigner { namespace Internal { @@ -53,12 +54,28 @@ QmlStateNodeInstance::Pointer return instance; } +void setAllNodesDirtyRecursive(QQuickItem *parentItem) +{ +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + Q_UNUSED(parentItem) +#else + if (!parentItem) + return; + const QList children = parentItem->childItems(); + for (QQuickItem *childItem : children) + setAllNodesDirtyRecursive(childItem); + DesignerSupport::addDirty(parentItem, QQuickDesignerSupport::Content); +#endif +} + void QmlStateNodeInstance::activateState() { if (!QmlPrivateGate::States::isStateActive(object(), context()) && nodeInstanceServer()->hasInstanceForObject(object())) { nodeInstanceServer()->setStateInstance(nodeInstanceServer()->instanceForObject(object())); QmlPrivateGate::States::activateState(object(), context()); + + setAllNodesDirtyRecursive(nodeInstanceServer()->rootItem()); } }