summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/itemviews/qtreeview.cpp13
-rw-r--r--src/gui/itemviews/qtreeview.h3
-rw-r--r--src/gui/itemviews/qtreeview_p.h17
3 files changed, 20 insertions, 13 deletions
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index e4c7cd3..f13ff0c 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -2837,6 +2837,9 @@ void QTreeViewPrivate::initialize()
header->setStretchLastSection(true);
header->setDefaultAlignment(Qt::AlignLeft|Qt::AlignVCenter);
q->setHeader(header);
+#ifndef QT_NO_ANIMATION
+ QObject::connect(&animatedOperation, SIGNAL(finished()), q, SLOT(_q_endAnimatedOperation()));
+#endif //QT_NO_ANIMATION
}
void QTreeViewPrivate::expand(int item, bool emitSignal)
@@ -2920,7 +2923,7 @@ void QTreeViewPrivate::collapse(int item, bool emitSignal)
void QTreeViewPrivate::prepareAnimatedOperation(int item, QVariantAnimation::Direction direction)
{
animatedOperation.item = item;
- animatedOperation.view = q_func();
+ animatedOperation.viewport = viewport;
animatedOperation.setDirection(direction);
int top = coordinateForItem(item) + itemHeight(item);
@@ -3008,6 +3011,14 @@ QPixmap QTreeViewPrivate::renderTreeToPixmapForAnimation(const QRect &rect) cons
return pixmap;
}
+
+void QTreeViewPrivate::_q_endAnimatedOperation()
+{
+ Q_Q(QTreeView);
+ q->setState(QAbstractItemView::NoState);
+ q->updateGeometries();
+ viewport->update();
+}
#endif //QT_NO_ANIMATION
void QTreeViewPrivate::_q_modelAboutToBeReset()
diff --git a/src/gui/itemviews/qtreeview.h b/src/gui/itemviews/qtreeview.h
index b2a9de2f..4411781 100644
--- a/src/gui/itemviews/qtreeview.h
+++ b/src/gui/itemviews/qtreeview.h
@@ -223,6 +223,9 @@ private:
Q_DECLARE_PRIVATE(QTreeView)
Q_DISABLE_COPY(QTreeView)
+#ifndef QT_NO_ANIMATION
+ Q_PRIVATE_SLOT(d_func(), void _q_endAnimatedOperation())
+#endif //QT_NO_ANIMATION
Q_PRIVATE_SLOT(d_func(), void _q_modelAboutToBeReset())
Q_PRIVATE_SLOT(d_func(), void _q_sortIndicatorChanged(int column, Qt::SortOrder order))
};
diff --git a/src/gui/itemviews/qtreeview_p.h b/src/gui/itemviews/qtreeview_p.h
index 38f6fd3..6fb2e41 100644
--- a/src/gui/itemviews/qtreeview_p.h
+++ b/src/gui/itemviews/qtreeview_p.h
@@ -95,25 +95,18 @@ public:
int item;
QPixmap before;
QPixmap after;
- QTreeView *view;
+ QWidget *viewport;
AnimatedOperation() : item(0) { setEasingCurve(QEasingCurve::InOutQuad); }
int top() const { return startValue().toInt(); }
- QRect rect() const { QRect rect = view->viewport()->rect(); rect.moveTop(top()); return rect; }
- void updateCurrentValue(const QVariant &) { view->viewport()->update(rect()); }
- void updateState(State, State state)
- {
- if (state == Stopped) {
- before = after = QPixmap();
- view->setState(QAbstractItemView::NoState);
- view->updateGeometries();
- view->viewport()->update();
- }
- }
+ QRect rect() const { QRect rect = viewport->rect(); rect.moveTop(top()); return rect; }
+ void updateCurrentValue(const QVariant &) { viewport->update(rect()); }
+ void updateState(State, State state) { if (state == Stopped) before = after = QPixmap(); }
} animatedOperation;
void prepareAnimatedOperation(int item, QVariantAnimation::Direction d);
void beginAnimatedOperation();
void drawAnimatedOperation(QPainter *painter) const;
QPixmap renderTreeToPixmapForAnimation(const QRect &rect) const;
+ void _q_endAnimatedOperation();
#endif //QT_NO_ANIMATION
void expand(int item, bool emitSignal);