diff options
author | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-11-12 15:33:42 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-11-13 09:09:49 (GMT) |
commit | 671fb279defa0a97c38c28dded767f58c67f9dac (patch) | |
tree | 1dc5793e6e625d38a4d80effaf75046af64c1273 /src/gui/graphicsview | |
parent | 57d05153b3ef2df1f1dd38eb9560d6019e1bcd4a (diff) | |
download | Qt-671fb279defa0a97c38c28dded767f58c67f9dac.zip Qt-671fb279defa0a97c38c28dded767f58c67f9dac.tar.gz Qt-671fb279defa0a97c38c28dded767f58c67f9dac.tar.bz2 |
Fixes QGraphicsWidget: paint() being called before polish().
The problem is that we request an update() before we schedules a polish
event in QGraphicsScene::addItems, which means paint() is being called before
polishEvent(). We could try to swap the order in addItems, but that
doesn't give us any guarantee that polish is delivered before update
(since we have no control over what's happening from outside graphics
view). A better solution is to always make sure we don't have unpolished
items before we draw.
Auto-test included.
Task-number: QTBUG-4979
Reviewed-by: Andreas
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 13f31b8..5b0643d 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4551,6 +4551,10 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte void QGraphicsScenePrivate::drawItems(QPainter *painter, const QTransform *const viewTransform, QRegion *exposedRegion, QWidget *widget) { + // Make sure we don't have unpolished items before we draw. + if (!unpolishedItems.isEmpty()) + _q_polishItems(); + QRectF exposedSceneRect; if (exposedRegion && indexMethod != QGraphicsScene::NoIndex) { exposedSceneRect = exposedRegion->boundingRect().adjusted(-1, -1, 1, 1); @@ -5077,6 +5081,10 @@ void QGraphicsScene::drawItems(QPainter *painter, const QStyleOptionGraphicsItem options[], QWidget *widget) { Q_D(QGraphicsScene); + // Make sure we don't have unpolished items before we draw. + if (!d->unpolishedItems.isEmpty()) + d->_q_polishItems(); + QTransform viewTransform = painter->worldTransform(); Q_UNUSED(options); |