Commit 106e940d authored by Thomas Hartmann's avatar Thomas Hartmann

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
......@@ -72,12 +72,36 @@ QList<ServerNodeInstance> GraphicsObjectNodeInstance::childItems() const
QGraphicsObject *childObject = item->toGraphicsObject();
if (childObject && nodeInstanceServer()->hasInstanceForObject(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;
}
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)
{
m_hasContent = hasContent;
......
......@@ -76,6 +76,7 @@ public:
bool hasContent() const;
QList<ServerNodeInstance> childItems() const;
QList<ServerNodeInstance> childItemsForChild(QGraphicsItem *childItem) const;
void paintUpdate();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment