From 282a46ab5edafa7b82e9c58658143cb979db2d85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 27 Jan 2010 12:10:24 +0100 Subject: Speed up QmlGraphicsItem::setParentItem. We avoid unnecessary QVariant constructions / notifications / virtual function calls by calling the QGraphicsItemPrivate::setParentItemHelper directly. Reviewed-by: Aaron Kennedy --- src/declarative/graphicsitems/qmlgraphicsitem.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.cpp b/src/declarative/graphicsitems/qmlgraphicsitem.cpp index dd685d4..bd3c1ea 100644 --- a/src/declarative/graphicsitems/qmlgraphicsitem.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsitem.cpp @@ -1533,8 +1533,12 @@ void QmlGraphicsItem::setParentItem(QmlGraphicsItem *parent) QmlGraphicsItem *oldParent = parentItem(); if (parent == oldParent || !parent) return; + Q_D(QmlGraphicsItem); QObject::setParent(parent); - QGraphicsObject::setParentItem(parent); + d->setParentItemHelper(parent, /*newParentVariant=*/0, /*thisPointerVariant=*/0); + if (oldParent) + emit oldParent->childrenChanged(); + emit parentChanged(); } /*! -- cgit v0.12