Fixed the QTreeView expansion/collpasing when animated
authorThierry Bastian <thierryb@filewave.com>
Wed, 29 Aug 2012 12:24:40 +0000 (14:24 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 29 Aug 2012 18:40:17 +0000 (20:40 +0200)
commit1e97dbaf6ca807397e3ec77a3611763769499d17
treef883e022d89b4ffb84c597cfd4c5199a121b739e
parentc1e5f600abaee393e66fb04e2038bc97d82851ef
Fixed the QTreeView expansion/collpasing when animated

If you had a QTreeView with expandable items, if you tried to expand and while
the animation was still running you'd try to collpase the node,
the display would be completely broken: the items below that items would
not be visible any more except for a fraction of a second when expanding
or collapsing it again.
The problem is in the fact that when starting an animation the QTreeView
stores the state before animating. And it does that even if an animation
is already running. So the stateBeforeAnimation becomes AnimatingState and
when the animation finishes, AnimatingState is the state that is restored
breaking the painting.
Unit test is included.

Change-Id: I015212c1ed8962e6df705655099a5660f195caf3
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
src/widgets/itemviews/qtreeview.cpp
tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp