From cbca69bb0c7e3c42bf7d2d964057f38263de0553 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 20 Oct 2009 15:59:40 +0200 Subject: fix for QTreeView to not animate if there are no visible children --- src/gui/itemviews/qtreeview.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index d597f5c..f37d8c7 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -2913,7 +2913,7 @@ void QTreeViewPrivate::expand(int item, bool emitSignal) if (emitSignal) { emit q->expanded(index); #ifndef QT_NO_ANIMATION - if (animationsEnabled && model->hasChildren(index)) + if (animationsEnabled) beginAnimatedOperation(); #endif //QT_NO_ANIMATION } @@ -3005,10 +3005,12 @@ void QTreeViewPrivate::beginAnimatedOperation() animatedOperation.setEndValue(animatedOperation.top() + h); } - animatedOperation.after = renderTreeToPixmapForAnimation(rect); + if (!rect.isEmpty()) { + animatedOperation.after = renderTreeToPixmapForAnimation(rect); - q->setState(QAbstractItemView::AnimatingState); - animatedOperation.start(); //let's start the animation + q->setState(QAbstractItemView::AnimatingState); + animatedOperation.start(); //let's start the animation + } } void QTreeViewPrivate::drawAnimatedOperation(QPainter *painter) const -- cgit v0.12