QmlDesigner:Instances: Adding instance for QQuickWindow

This allows QuickWindowNodeInstance to return the content item
instead.

The function parentObject() in ObjectNodeInstance now knows
QQuickRootItem, because the parent of the root item should
is the windows (which is just a QObject but treated as item from us).

Change-Id: Ibaa7ccc8dd9346689cc4443ce0b594056feaa0cf
Reviewed-by: Marco Bubke <marco.bubke@digia.com>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
Thomas Hartmann
2013-04-18 11:56:23 +02:00
parent 67825ab2dc
commit 58e280de2c
5 changed files with 744 additions and 1 deletions
@@ -1124,8 +1124,14 @@ QObject *ObjectNodeInstance::parent() const
QObject *parentObject(QObject *object)
{
QQuickItem *quickItem = qobject_cast<QQuickItem*>(object);
if (quickItem)
if (quickItem && quickItem->parentItem()) {
//QQuickRootItem is used by Window and we want to return the Window as parent
if (strcmp(quickItem->metaObject()->className(), "QQuickRootItem"))
return object->parent();
return quickItem->parentItem();
}
return object->parent();
}