diff options
author | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2011-02-09 15:07:24 +0100 |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2011-05-12 15:47:26 +0200 |
commit | 913ff732004c2c61c39bcdd82ff05ea1827f328b (patch) | |
tree | 7e0b50b23cabaf3643fd64806e8ab6577e7e86d5 /src/gui/graphicsview/qgraphicslinearlayout.cpp | |
parent | 1ce725cb60358a31b1107ab5c892abb7ceca8453 (diff) |
Avoid flicker when invalidate is propagated in a widget/layout hierarchy
* Do not call invalidate from activateRecursive().
This resulted in that a layout was invalidated as many times as there
were items in the layout.
* Several improvements. Do not call resize(size()) too often.
Calling resize() from the widgetEvent() is not very nice though...
* Remove commented out code
* make sure layout is activated even if the widget does not change size
* activate the layout if the resize is same as size()
* In order to not break existing apps, make this an opt-in feature
with QGraphicsLayout::setInstantInvalidatePropagation(true);
Reviewed-by: Frederik Gladhorn
Reviewed-by: John Tapsell
Diffstat (limited to 'src/gui/graphicsview/qgraphicslinearlayout.cpp')
-rw-r--r-- | src/gui/graphicsview/qgraphicslinearlayout.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp index 5591638395..1229379ee8 100644 --- a/src/gui/graphicsview/qgraphicslinearlayout.cpp +++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp @@ -275,17 +275,16 @@ 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); d->fixIndex(&index); d->engine.insertRow(index, d->orientation); new QGridLayoutItem(&d->engine, item, d->gridRow(index), d->gridColumn(index), 1, 1, 0, index); + //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(); } /*! |