diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2010-07-01 07:53:19 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2010-07-01 07:53:19 (GMT) |
commit | d33268507b4a5f4a30ee0b24db45d4b79ef8f1c3 (patch) | |
tree | 5ce839e09f037f19144c911cfa99cc768f54199b /src/gui/itemviews/qtreeview.cpp | |
parent | 52bf57e4fd065cd6699bd951c73191675954ec96 (diff) | |
download | Qt-d33268507b4a5f4a30ee0b24db45d4b79ef8f1c3.zip Qt-d33268507b4a5f4a30ee0b24db45d4b79ef8f1c3.tar.gz Qt-d33268507b4a5f4a30ee0b24db45d4b79ef8f1c3.tar.bz2 |
Auto expand of QTreeWidget does not work correctly if animated
The problem was that the internal state of the tree was not correctly
reset. Patch comes from the task.
Task-number: QTBUG-10850
Diffstat (limited to 'src/gui/itemviews/qtreeview.cpp')
-rw-r--r-- | src/gui/itemviews/qtreeview.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 54f8d05..ccc8e00 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -2861,13 +2861,13 @@ void QTreeViewPrivate::expand(int item, bool emitSignal) if (emitSignal && animationsEnabled) prepareAnimatedOperation(item, QVariantAnimation::Forward); #endif //QT_NO_ANIMATION - QAbstractItemView::State oldState = state; + stateBeforeAnimation = state; q->setState(QAbstractItemView::ExpandingState); const QModelIndex index = viewItems.at(item).index; storeExpanded(index); viewItems[item].expanded = true; layout(item); - q->setState(oldState); + q->setState(stateBeforeAnimation); if (model->canFetchMore(index)) model->fetchMore(index); @@ -2936,7 +2936,7 @@ void QTreeViewPrivate::collapse(int item, bool emitSignal) prepareAnimatedOperation(item, QVariantAnimation::Backward); #endif //QT_NO_ANIMATION - QAbstractItemView::State oldState = state; + stateBeforeAnimation = state; q->setState(QAbstractItemView::CollapsingState); expandedIndexes.erase(it); viewItems[item].expanded = false; @@ -2946,7 +2946,7 @@ void QTreeViewPrivate::collapse(int item, bool emitSignal) index = viewItems[index].parentItem; } removeViewItems(item + 1, total); // collapse - q->setState(oldState); + q->setState(stateBeforeAnimation); if (emitSignal) { emit q->collapsed(modelIndex); @@ -3057,7 +3057,7 @@ QPixmap QTreeViewPrivate::renderTreeToPixmapForAnimation(const QRect &rect) cons void QTreeViewPrivate::_q_endAnimatedOperation() { Q_Q(QTreeView); - q->setState(QAbstractItemView::NoState); + q->setState(stateBeforeAnimation); q->updateGeometries(); viewport->update(); } |