forked from qt-creator/qt-creator
QmlDesigner: Refresh items if state is changed
We have to paint each item after a state change. This seems to be a regression caused by the swtich to Qt 6. Task-number: QDS-5462 Change-Id: I10a1e0e03c7e887c0998864f397fcbe429364ec7 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
@@ -25,10 +25,11 @@
|
||||
|
||||
#include "qmlstatenodeinstance.h"
|
||||
|
||||
#include <qmlprivategate.h>
|
||||
|
||||
#include "qmlpropertychangesnodeinstance.h"
|
||||
|
||||
#include <qmlprivategate.h>
|
||||
#include <designersupportdelegate.h>
|
||||
|
||||
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<QQuickItem *> 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());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user