forked from qt-creator/qt-creator
QmlDesigner: Use the root NodeInstance for item collection
Change-Id: I0ed67997c371af8acb3db480446ea5d577380804 Reviewed-by: Marco Bubke <marco.bubke@digia.com>
This commit is contained in:
@@ -730,6 +730,11 @@ QList<ServerNodeInstance> ObjectNodeInstance::childItems() const
|
||||
return QList<ServerNodeInstance>();
|
||||
}
|
||||
|
||||
QList<QQuickItem *> ObjectNodeInstance::allItemsRecursive() const
|
||||
{
|
||||
return QList<QQuickItem *>();
|
||||
}
|
||||
|
||||
QList<ServerNodeInstance> ObjectNodeInstance::stateInstances() const
|
||||
{
|
||||
return QList<ServerNodeInstance>();
|
||||
|
||||
@@ -139,6 +139,7 @@ public:
|
||||
PropertyNameList propertyNames() const;
|
||||
|
||||
virtual QList<ServerNodeInstance> childItems() const;
|
||||
virtual QList<QQuickItem*> allItemsRecursive() const;
|
||||
|
||||
void createDynamicProperty(const QString &PropertyName, const QString &typeName);
|
||||
void setDeleteHeldInstance(bool deleteInstance);
|
||||
|
||||
@@ -117,14 +117,10 @@ QList<QQuickItem*> subItems(QQuickItem *parentItem)
|
||||
|
||||
QList<QQuickItem*> Qt5NodeInstanceServer::allItems() const
|
||||
{
|
||||
QList<QQuickItem*> itemList;
|
||||
if (rootNodeInstance().isValid())
|
||||
return rootNodeInstance().allItemsRecursive();
|
||||
|
||||
if (quickView()) {
|
||||
itemList.append(quickView()->rootObject());
|
||||
itemList.append(subItems(quickView()->rootObject()));
|
||||
}
|
||||
|
||||
return itemList;
|
||||
return QList<QQuickItem*>();
|
||||
}
|
||||
|
||||
void Qt5NodeInstanceServer::refreshBindings()
|
||||
|
||||
@@ -138,6 +138,28 @@ void QuickItemNodeInstance::doComponentComplete()
|
||||
m_contentItem = contentItemProperty.read().value<QQuickItem*>();
|
||||
}
|
||||
|
||||
static QList<QQuickItem *> allItems(QQuickItem *parentItem)
|
||||
{
|
||||
QList<QQuickItem *> itemList;
|
||||
|
||||
itemList.append(parentItem);
|
||||
itemList.append(parentItem->childItems());
|
||||
|
||||
foreach (QQuickItem *childItem, parentItem->childItems()) {
|
||||
itemList.append(allItems(childItem));
|
||||
}
|
||||
|
||||
return itemList;
|
||||
}
|
||||
|
||||
QList<QQuickItem *> QuickItemNodeInstance::allItemsRecursive() const
|
||||
{
|
||||
if (quickItem())
|
||||
return allItems(quickItem());
|
||||
|
||||
return QList<QQuickItem *>();
|
||||
}
|
||||
|
||||
QRectF QuickItemNodeInstance::contentItemBoundingBox() const
|
||||
{
|
||||
if (contentItem()) {
|
||||
|
||||
@@ -68,6 +68,8 @@ public:
|
||||
|
||||
void doComponentComplete();
|
||||
|
||||
QList<QQuickItem*> allItemsRecursive() const;
|
||||
|
||||
protected:
|
||||
QuickItemNodeInstance(QQuickItem*);
|
||||
QQuickItem *quickItem() const;
|
||||
|
||||
@@ -638,6 +638,11 @@ QQuickItem *ServerNodeInstance::rootQuickItem() const
|
||||
return qobject_cast<QQuickItem*>(internalObject());
|
||||
}
|
||||
|
||||
QList<QQuickItem *> ServerNodeInstance::allItemsRecursive() const
|
||||
{
|
||||
return m_nodeInstance->allItemsRecursive();
|
||||
}
|
||||
|
||||
QString ServerNodeInstance::id() const
|
||||
{
|
||||
return m_nodeInstance->id();
|
||||
|
||||
@@ -158,6 +158,8 @@ public:
|
||||
QList<ServerNodeInstance> childItems() const;
|
||||
|
||||
QQuickItem *rootQuickItem() const;
|
||||
QList<QQuickItem *> allItemsRecursive() const;
|
||||
|
||||
QString id() const;
|
||||
qint32 instanceId() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user