summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2010-09-29 10:56:38 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2010-09-29 11:01:13 (GMT)
commit33f525e636ef8fa64a15d3e66c56adaea0075bda (patch)
treebc16d3be7bc7f1b5e8022b5cf1b65c6a6d9ab803 /src/gui/graphicsview
parent413ca01cc5c2f74e34ddc8d4917e65d5318aa58e (diff)
downloadQt-33f525e636ef8fa64a15d3e66c56adaea0075bda.zip
Qt-33f525e636ef8fa64a15d3e66c56adaea0075bda.tar.gz
Qt-33f525e636ef8fa64a15d3e66c56adaea0075bda.tar.bz2
Fix double painting when adding an item into a linear layout
the problem was that the item is first painted at its default position, then moved by the layout and finally repainted. We now made sure the item is laid out before the first paint event occurs. Task-number: QTBUG-13865 Reviewed-by: bnilsen
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicslinearlayout.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp
index 1588364..7e8d19f 100644
--- a/src/gui/graphicsview/qgraphicslinearlayout.cpp
+++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp
@@ -275,13 +275,17 @@ void QGraphicsLinearLayout::insertItem(int index, QGraphicsLayoutItem *item)
qWarning("QGraphicsLinearLayout::insertItem: cannot insert itself");
return;
}
+ Q_ASSERT(item);
+
+ //the order of the following instructions is very important because
+ //invalidating the layout before adding the child item will make the layout happen
+ //before we try to paint the item
+ invalidate();
d->addChildLayoutItem(item);
- Q_ASSERT(item);
d->fixIndex(&index);
d->engine.insertRow(index, d->orientation);
new QGridLayoutItem(&d->engine, item, d->gridRow(index), d->gridColumn(index), 1, 1, 0, index);
- invalidate();
}
/*!