diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-03-25 07:49:33 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-03-25 07:51:14 (GMT) |
commit | 72599ca45c416f2f0a9654412c14a148ca3d728c (patch) | |
tree | 9a48998382adf499e52d8a8a9b6169fbfa520374 /src/declarative/graphicsitems/qdeclarativeitem.cpp | |
parent | 672e06aef096d3e7a81826b28121f3314948eeff (diff) | |
download | Qt-72599ca45c416f2f0a9654412c14a148ca3d728c.zip Qt-72599ca45c416f2f0a9654412c14a148ca3d728c.tar.gz Qt-72599ca45c416f2f0a9654412c14a148ca3d728c.tar.bz2 |
Optimize QML "parent" property access
For properties that are as important as "parent", QML cannot afford the
overhead of a signal/slot connection.
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativeitem.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeitem.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index e6ade00..ee0682a 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1554,6 +1554,14 @@ void QDeclarativeItemPrivate::transform_clear(QDeclarativeListProperty<QGraphics } } +void QDeclarativeItemPrivate::parentProperty(QObject *o, void *rv, QDeclarativeNotifierEndpoint *e) +{ + QDeclarativeItem *item = static_cast<QDeclarativeItem*>(o); + if (e) + e->connect(&item->d_func()->parentNotifier); + *((QDeclarativeItem **)rv) = item->parentItem(); +} + /*! \qmlproperty list<Object> Item::data \default @@ -2539,10 +2547,11 @@ bool QDeclarativeItem::sceneEvent(QEvent *event) QVariant QDeclarativeItem::itemChange(GraphicsItemChange change, const QVariant &value) { - Q_D(const QDeclarativeItem); + Q_D(QDeclarativeItem); switch (change) { case ItemParentHasChanged: emit parentChanged(parentItem()); + d->parentNotifier.notify(); break; case ItemChildAddedChange: case ItemChildRemovedChange: |