diff options
author | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2010-01-27 11:10:24 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2010-01-27 11:10:24 (GMT) |
commit | 282a46ab5edafa7b82e9c58658143cb979db2d85 (patch) | |
tree | 7b9c7861f64b9a90474a1fb78eda4dfea8dc3109 | |
parent | dd8a0d85b070c363c8e4575ec967ae0ad8dfebec (diff) | |
download | Qt-282a46ab5edafa7b82e9c58658143cb979db2d85.zip Qt-282a46ab5edafa7b82e9c58658143cb979db2d85.tar.gz Qt-282a46ab5edafa7b82e9c58658143cb979db2d85.tar.bz2 |
Speed up QmlGraphicsItem::setParentItem.
We avoid unnecessary QVariant constructions / notifications / virtual
function calls by calling the QGraphicsItemPrivate::setParentItemHelper
directly.
Reviewed-by: Aaron Kennedy
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsitem.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
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(); } /*! |