summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2010-01-27 11:10:24 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2010-01-27 11:10:24 (GMT)
commit282a46ab5edafa7b82e9c58658143cb979db2d85 (patch)
tree7b9c7861f64b9a90474a1fb78eda4dfea8dc3109
parentdd8a0d85b070c363c8e4575ec967ae0ad8dfebec (diff)
downloadQt-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.cpp6
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();
}
/*!