summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-05-24 04:35:17 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-05-24 04:35:17 (GMT)
commit79446ca4e047e68bea68aef902a5d48478bcc9cc (patch)
tree3ad3a96ea51babc0cf7c5a8f340feafc083ce028 /src
parentff27b0e6a7161db17335dc4aa8724cae75cec39c (diff)
downloadQt-79446ca4e047e68bea68aef902a5d48478bcc9cc.zip
Qt-79446ca4e047e68bea68aef902a5d48478bcc9cc.tar.gz
Qt-79446ca4e047e68bea68aef902a5d48478bcc9cc.tar.bz2
Don't polish QDeclarativeItems.
Avoids unnecessary processing and assumptions we would not want to preserve in the future. Task-number: QTBUG-10217 Reviewed-by: Martin Jones
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp8
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp14
2 files changed, 16 insertions, 6 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 9547884..2841ac3 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -2681,7 +2681,13 @@ bool QDeclarativeItem::sceneEvent(QEvent *event)
}
}
-/*! \internal */
+/*!
+ \reimp
+
+ Note that unlike QGraphicsItems, QDeclarativeItem::itemChange() is \e not called
+ during initial widget polishing. Items wishing to optimize start-up construction
+ should instead consider using componentComplete().
+*/
QVariant QDeclarativeItem::itemChange(GraphicsItemChange change,
const QVariant &value)
{
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 344df30..ae0abf9 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -2545,12 +2545,16 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
return;
}
- if (d->unpolishedItems.isEmpty()) {
- QMetaMethod method = metaObject()->method(d->polishItemsIndex);
- method.invoke(this, Qt::QueuedConnection);
+ // QDeclarativeItems do not rely on initial itemChanged message, as the componentComplete
+ // function allows far more opportunity for delayed-construction optimization.
+ if (!item->d_ptr->isDeclarativeItem) {
+ if (d->unpolishedItems.isEmpty()) {
+ QMetaMethod method = metaObject()->method(d->polishItemsIndex);
+ method.invoke(this, Qt::QueuedConnection);
+ }
+ d->unpolishedItems.append(item);
+ item->d_ptr->pendingPolish = true;
}
- d->unpolishedItems.append(item);
- item->d_ptr->pendingPolish = true;
// Detach this item from its parent if the parent's scene is different
// from this scene.