Skip to content
Snippets Groups Projects
Commit 106e940d authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.nodeInstances: fix for flickable

Items with a viewport like flickable do not work in 2.2.
This is a regression from 2.1.

Reviewed-by: Kai Koehne
Task-number: QTCREATORBUG-3998
parent 8926297c
No related branches found
No related tags found
No related merge requests found
...@@ -72,12 +72,36 @@ QList<ServerNodeInstance> GraphicsObjectNodeInstance::childItems() const ...@@ -72,12 +72,36 @@ QList<ServerNodeInstance> GraphicsObjectNodeInstance::childItems() const
QGraphicsObject *childObject = item->toGraphicsObject(); QGraphicsObject *childObject = item->toGraphicsObject();
if (childObject && nodeInstanceServer()->hasInstanceForObject(childObject)) { if (childObject && nodeInstanceServer()->hasInstanceForObject(childObject)) {
instanceList.append(nodeInstanceServer()->instanceForObject(childObject)); instanceList.append(nodeInstanceServer()->instanceForObject(childObject));
} else { //there might be an item in between the parent instance
//and the child instance.
//Popular example is flickable which has a viewport item between
//the flickable item and the flickable children
instanceList.append(childItemsForChild(item)); //In such a case we go deeper inside the item and
//search for child items with instances.
} }
} }
return instanceList; return instanceList;
} }
QList<ServerNodeInstance> GraphicsObjectNodeInstance::childItemsForChild(QGraphicsItem *childItem) const
{
QList<ServerNodeInstance> instanceList;
if (childItem) {
foreach(QGraphicsItem *item, childItem->childItems())
{
QGraphicsObject *childObject = item->toGraphicsObject();
if (childObject && nodeInstanceServer()->hasInstanceForObject(childObject)) {
instanceList.append(nodeInstanceServer()->instanceForObject(childObject));
} else {
instanceList.append(childItemsForChild(item));
}
}
}
return instanceList;
}
void GraphicsObjectNodeInstance::setHasContent(bool hasContent) void GraphicsObjectNodeInstance::setHasContent(bool hasContent)
{ {
m_hasContent = hasContent; m_hasContent = hasContent;
......
...@@ -76,6 +76,7 @@ public: ...@@ -76,6 +76,7 @@ public:
bool hasContent() const; bool hasContent() const;
QList<ServerNodeInstance> childItems() const; QList<ServerNodeInstance> childItems() const;
QList<ServerNodeInstance> childItemsForChild(QGraphicsItem *childItem) const;
void paintUpdate(); void paintUpdate();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment