summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-07-07 13:56:07 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-07-07 13:56:07 (GMT)
commite348e7b633ff3a0279d4d1759e35f0920afcc3e0 (patch)
tree3d3268aed6a7bd12a5757b444e2420a08a707c46 /src/gui/itemviews
parent1a112561126c7f2148d91e40a6c3f52ccf506fd5 (diff)
downloadQt-e348e7b633ff3a0279d4d1759e35f0920afcc3e0.zip
Qt-e348e7b633ff3a0279d4d1759e35f0920afcc3e0.tar.gz
Qt-e348e7b633ff3a0279d4d1759e35f0920afcc3e0.tar.bz2
QColumnView: new uses QPropertyAnimation over QTimeLine
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qcolumnview.cpp27
-rw-r--r--src/gui/itemviews/qcolumnview_p.h4
2 files changed, 9 insertions, 22 deletions
diff --git a/src/gui/itemviews/qcolumnview.cpp b/src/gui/itemviews/qcolumnview.cpp
index ff20163..fc89967 100644
--- a/src/gui/itemviews/qcolumnview.cpp
+++ b/src/gui/itemviews/qcolumnview.cpp
@@ -107,9 +107,10 @@ void QColumnViewPrivate::initialize()
{
Q_Q(QColumnView);
q->setTextElideMode(Qt::ElideMiddle);
- QObject::connect(&currentAnimation, SIGNAL(frameChanged(int)),
- hbar, SLOT(setValue(int)));
QObject::connect(&currentAnimation, SIGNAL(finished()), q, SLOT(_q_changeCurrentColumn()));
+ currentAnimation.setDuration(ANIMATION_DURATION_MSEC);
+ currentAnimation.setTargetObject(hbar);
+ currentAnimation.setEasingCurve(QEasingCurve::InOutQuad);
delete itemDelegate;
q->setItemDelegate(new QColumnViewDelegate(q));
}
@@ -259,7 +260,7 @@ void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint)
if (!index.isValid() || d->columns.isEmpty())
return;
- if (d->currentAnimation.state() == QTimeLine::Running)
+ if (d->currentAnimation.state() == QPropertyAnimation::Running)
return;
d->currentAnimation.stop();
@@ -325,21 +326,7 @@ void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint)
}
}
- //horizontalScrollBar()->setValue(newScrollbarValue);
- //d->_q_changeCurrentColumn();
- //return;
- // or do the following currentAnimation
-
- int oldValue = horizontalScrollBar()->value();
-
- if (oldValue < newScrollbarValue) {
- d->currentAnimation.setFrameRange(oldValue, newScrollbarValue);
- d->currentAnimation.setDirection(QTimeLine::Forward);
- d->currentAnimation.setCurrentTime(0);
- } else {
- d->currentAnimation.setFrameRange(newScrollbarValue, oldValue);
- d->currentAnimation.setDirection(QTimeLine::Backward);
- }
+ d->currentAnimation.setEndValue(newScrollbarValue);
d->currentAnimation.start();
}
@@ -409,7 +396,7 @@ void QColumnView::resizeEvent(QResizeEvent *event)
void QColumnViewPrivate::updateScrollbars()
{
Q_Q(QColumnView);
- if (currentAnimation.state() == QTimeLine::Running)
+ if (currentAnimation.state() == QPropertyAnimation::Running)
return;
// find the total horizontal length of the laid out columns
@@ -1044,7 +1031,7 @@ QColumnViewPrivate::QColumnViewPrivate()
: QAbstractItemViewPrivate()
,showResizeGrips(true)
,offset(0)
-,currentAnimation(ANIMATION_DURATION_MSEC)
+,currentAnimation(0, "value") // will set the target later
,previewWidget(0)
,previewColumn(0)
{
diff --git a/src/gui/itemviews/qcolumnview_p.h b/src/gui/itemviews/qcolumnview_p.h
index 233dc3c..1a8be70 100644
--- a/src/gui/itemviews/qcolumnview_p.h
+++ b/src/gui/itemviews/qcolumnview_p.h
@@ -60,7 +60,7 @@
#include <private/qabstractitemview_p.h>
#include <QtCore/qabstractitemmodel.h>
-#include <QtCore/qtimeline.h>
+#include <QtCore/qpropertyanimation.h>
#include <QtGui/qabstractitemdelegate.h>
#include <QtGui/qabstractitemview.h>
#include <QtGui/qitemdelegate.h>
@@ -160,7 +160,7 @@ public:
QVector<int> columnSizes; // used during init and corner moving
bool showResizeGrips;
int offset;
- QTimeLine currentAnimation;
+ QPropertyAnimation currentAnimation;
QWidget *previewWidget;
QAbstractItemView *previewColumn;
};