QmlDesigner: Inspect components for existing states

For each created items we retrieve a list of the names
of all existing states.

Task-number: QDS-1978
Change-Id: I8e85e439fce3c6204cb8bcf69f6be847cc8dae5c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2020-04-21 08:06:43 +02:00
parent dbccc57597
commit 3caafb2b81
10 changed files with 50 additions and 0 deletions

View File

@@ -232,6 +232,20 @@ QList<QQuickItem *> QuickItemNodeInstance::allItemsRecursive() const
return itemList;
}
QStringList QuickItemNodeInstance::allStates() const
{
QStringList list;
QList<QObject*> stateList = DesignerSupport::statesForItem(quickItem());
for (QObject *state : stateList) {
QQmlProperty property(state, "name");
if (property.isValid())
list.append(property.read().toString());
}
return list;
}
QRectF QuickItemNodeInstance::contentItemBoundingBox() const
{
if (contentItem()) {