summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-07-08 13:12:08 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-07-08 13:12:08 (GMT)
commit19a824cfe36458732f12e6374848df37cd92eed8 (patch)
tree78f4bd9aa3327e655ea09a9da906e03e146d1f22 /src/gui/itemviews
parent12dc33d0e7191dbabb03db989b0f56372de731e3 (diff)
downloadQt-19a824cfe36458732f12e6374848df37cd92eed8.zip
Qt-19a824cfe36458732f12e6374848df37cd92eed8.tar.gz
Qt-19a824cfe36458732f12e6374848df37cd92eed8.tar.bz2
Animations: fix compilation with QT_NO_ANIMATION
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qcolumnview.cpp12
-rw-r--r--src/gui/itemviews/qcolumnview_p.h2
2 files changed, 13 insertions, 1 deletions
diff --git a/src/gui/itemviews/qcolumnview.cpp b/src/gui/itemviews/qcolumnview.cpp
index fc89967..c544394 100644
--- a/src/gui/itemviews/qcolumnview.cpp
+++ b/src/gui/itemviews/qcolumnview.cpp
@@ -107,10 +107,13 @@ void QColumnViewPrivate::initialize()
{
Q_Q(QColumnView);
q->setTextElideMode(Qt::ElideMiddle);
+#ifndef QT_NO_ANIMATION
QObject::connect(&currentAnimation, SIGNAL(finished()), q, SLOT(_q_changeCurrentColumn()));
currentAnimation.setDuration(ANIMATION_DURATION_MSEC);
currentAnimation.setTargetObject(hbar);
+ currentAnimation.setPropertyName("value");
currentAnimation.setEasingCurve(QEasingCurve::InOutQuad);
+#endif //QT_NO_ANIMATION
delete itemDelegate;
q->setItemDelegate(new QColumnViewDelegate(q));
}
@@ -260,10 +263,12 @@ void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint)
if (!index.isValid() || d->columns.isEmpty())
return;
+#ifndef QT_NO_ANIMATION
if (d->currentAnimation.state() == QPropertyAnimation::Running)
return;
d->currentAnimation.stop();
+#endif //QT_NO_ANIMATION
// Fill up what is needed to get to index
d->closeColumns(index, true);
@@ -326,8 +331,12 @@ void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint)
}
}
+#ifndef QT_NO_ANIMATION
d->currentAnimation.setEndValue(newScrollbarValue);
d->currentAnimation.start();
+#else
+ horizontalScrollBar()->setValue(newScrollbarValue);
+#endif //QT_NO_ANIMATION
}
/*!
@@ -396,8 +405,10 @@ void QColumnView::resizeEvent(QResizeEvent *event)
void QColumnViewPrivate::updateScrollbars()
{
Q_Q(QColumnView);
+#ifndef QT_NO_ANIMATION
if (currentAnimation.state() == QPropertyAnimation::Running)
return;
+#endif //QT_NO_ANIMATION
// find the total horizontal length of the laid out columns
int horizontalLength = 0;
@@ -1031,7 +1042,6 @@ QColumnViewPrivate::QColumnViewPrivate()
: QAbstractItemViewPrivate()
,showResizeGrips(true)
,offset(0)
-,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 1a8be70..3f99220 100644
--- a/src/gui/itemviews/qcolumnview_p.h
+++ b/src/gui/itemviews/qcolumnview_p.h
@@ -160,7 +160,9 @@ public:
QVector<int> columnSizes; // used during init and corner moving
bool showResizeGrips;
int offset;
+#ifndef QT_NO_ANIMATION
QPropertyAnimation currentAnimation;
+#endif
QWidget *previewWidget;
QAbstractItemView *previewColumn;
};