From c593492d1678a2ec08f1bfffcb572459b3bc6c00 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 26 Sep 2018 15:39:35 +0200 Subject: Modernize the "animation" feature Change-Id: Ibc164b3df3cf87db569ef4813de458a9067b7f7d Reviewed-by: Edward Welbourne Reviewed-by: Oswald Buddenhagen --- src/widgets/util/qscroller.cpp | 18 +++++++++--------- src/widgets/util/qscroller_p.h | 6 ++++-- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'src/widgets/util') diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp index 903a141e49..ea8168b55c 100644 --- a/src/widgets/util/qscroller.cpp +++ b/src/widgets/util/qscroller.cpp @@ -191,7 +191,7 @@ static qreal progressForValue(const QEasingCurve &curve, qreal value) } -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) class QScrollTimer : public QAbstractAnimation { public: @@ -230,7 +230,7 @@ private: bool ignoreUpdate; int skip; }; -#endif // QT_NO_ANIMATION +#endif // animation /*! \class QScroller @@ -896,7 +896,7 @@ QScrollerPrivate::QScrollerPrivate(QScroller *q, QObject *_target) , snapIntervalX(0.0) , snapFirstY(-1.0) , snapIntervalY(0.0) -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) , scrollTimer(new QScrollTimer(this)) #endif , q_ptr(q) @@ -938,7 +938,7 @@ const char *QScrollerPrivate::inputName(QScroller::Input input) void QScrollerPrivate::targetDestroyed() { -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) scrollTimer->stop(); #endif delete q_ptr; @@ -966,7 +966,7 @@ void QScrollerPrivate::timerTick() } } -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) scrollTimer->stop(); #endif } @@ -1690,7 +1690,7 @@ void QScrollerPrivate::setState(QScroller::State newstate) switch (newstate) { case QScroller::Inactive: -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) scrollTimer->stop(); #endif @@ -1702,7 +1702,7 @@ void QScrollerPrivate::setState(QScroller::State newstate) break; case QScroller::Pressed: -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) scrollTimer->stop(); #endif @@ -1712,14 +1712,14 @@ void QScrollerPrivate::setState(QScroller::State newstate) case QScroller::Dragging: dragDistance = QPointF(0, 0); -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) if (state == QScroller::Pressed) scrollTimer->start(); #endif break; case QScroller::Scrolling: -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) scrollTimer->start(); #endif break; diff --git a/src/widgets/util/qscroller_p.h b/src/widgets/util/qscroller_p.h index 5e0c359514..13e2032a5c 100644 --- a/src/widgets/util/qscroller_p.h +++ b/src/widgets/util/qscroller_p.h @@ -64,7 +64,9 @@ #include #include #include +#if QT_CONFIG(animation) #include +#endif QT_BEGIN_NAMESPACE @@ -72,7 +74,7 @@ QT_BEGIN_NAMESPACE class QFlickGestureRecognizer; #endif -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) class QScrollTimer; #endif class QScrollerPrivate : public QObject @@ -196,7 +198,7 @@ public: QElapsedTimer monotonicTimer; QPointF releaseVelocity; // the starting velocity of the scrolling state -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) QScrollTimer *scrollTimer; #endif -- cgit v1.2.3