forked from qt-creator/qt-creator
QmlDesigner: Implement ObjectNodeInstance::stateInstances() for StateGroup
Change-Id: Ia6e239530d399da34ab63253762e3ebd2a79f4db Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
This commit is contained in:
@@ -46,6 +46,10 @@
|
|||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
#include <QJSValue>
|
#include <QJSValue>
|
||||||
|
|
||||||
|
#include <private/qquickstategroup_p.h>
|
||||||
|
|
||||||
|
#include <qquickitem.h>
|
||||||
|
|
||||||
static bool isSimpleExpression(const QString &expression)
|
static bool isSimpleExpression(const QString &expression)
|
||||||
{
|
{
|
||||||
if (expression.startsWith(QStringLiteral("{")))
|
if (expression.startsWith(QStringLiteral("{")))
|
||||||
@@ -656,8 +660,18 @@ QList<QQuickItem *> ObjectNodeInstance::allItemsRecursive() const
|
|||||||
return QList<QQuickItem *>();
|
return QList<QQuickItem *>();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ServerNodeInstance> ObjectNodeInstance::stateInstances() const
|
QList<ServerNodeInstance> ObjectNodeInstance::stateInstances() const
|
||||||
{
|
{
|
||||||
|
if (auto group = qobject_cast<QQuickStateGroup*>(object())) {
|
||||||
|
QList<ServerNodeInstance> instanceList;
|
||||||
|
const QList<QQuickState *> stateList = group->states();
|
||||||
|
for (QQuickState *state : stateList) {
|
||||||
|
if (state && nodeInstanceServer()->hasInstanceForObject(state))
|
||||||
|
instanceList.append(nodeInstanceServer()->instanceForObject(state));
|
||||||
|
}
|
||||||
|
return instanceList;
|
||||||
|
}
|
||||||
|
|
||||||
return QList<ServerNodeInstance>();
|
return QList<ServerNodeInstance>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user