Parent delegate items to PathView.
authorAndrew den Exter <andrew.den-exter@nokia.com>
Thu, 17 Nov 2011 01:23:52 +0000 (11:23 +1000)
committerQt by Nokia <qt-info@nokia.com>
Fri, 18 Nov 2011 05:47:51 +0000 (06:47 +0100)
This is consistent with ListView and GridView and ensures the items
live only as long as the view and are deleted on application shutdown
where deferred delete events are discarded.

Change-Id: I77174b2725310d068fbba89b57e0da59619ef22a
Reviewed-by: Martin Jones <martin.jones@nokia.com>
src/declarative/items/qquickpathview.cpp

index c4da6f5..c7eee84 100644 (file)
@@ -125,6 +125,7 @@ QQuickItem *QQuickPathViewPrivate::getItem(int modelIndex, bool onPath)
             att->m_view = q;
             att->setOnPath(onPath);
         }
+        QDeclarative_setParent_noEvent(item, q);
         item->setParentItem(q);
         QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
         itemPrivate->addItemChangeListener(this, QQuickItemPrivate::Geometry);
@@ -1601,6 +1602,7 @@ void QQuickPathView::createdItem(int index, QQuickItem *item)
             att->m_view = this;
             att->setOnPath(false);
         }
+        QDeclarative_setParent_noEvent(item, this);
         item->setParentItem(this);
         d->updateItem(item, index < d->firstIndex ? 0.0 : 1.0);
     }