aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/util/qquicksmoothedanimation.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@jollamobile.com>2014-02-12 23:31:22 -0600
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-20 04:27:15 +0100
commit7da483bfbefcaabb1dbbf3e2f1d5b5f7aadc3b06 (patch)
tree30a6bdb4cf3d7275c3acf8ffcfaa5aae0b594819 /src/quick/util/qquicksmoothedanimation.cpp
parent587444f033cf51251f36321321ae358d187f37f9 (diff)
Make SmoothedAnimation and SpringAnimation smoothly transition again.
Fix regression introduced in Qt 5.0 when animation backend was rewritten. Task-number: QTBUG-36709 Change-Id: Ib8caa4bc6a38e3bb4c1d1d3961f775fdd2b342c7 Reviewed-by: Martin Jones <martin.jones@jollamobile.com>
Diffstat (limited to 'src/quick/util/qquicksmoothedanimation.cpp')
-rw-r--r--src/quick/util/qquicksmoothedanimation.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/quick/util/qquicksmoothedanimation.cpp b/src/quick/util/qquicksmoothedanimation.cpp
index 9e9e6cb419..a0e6c36830 100644
--- a/src/quick/util/qquicksmoothedanimation.cpp
+++ b/src/quick/util/qquicksmoothedanimation.cpp
@@ -43,6 +43,7 @@
#include "qquicksmoothedanimation_p_p.h"
#include "qquickanimation_p_p.h"
+#include "private/qcontinuinganimationgroupjob_p.h"
#include <qqmlproperty.h>
#include <private/qqmlproperty_p.h>
@@ -78,7 +79,7 @@ QSmoothedAnimation::QSmoothedAnimation(QQuickSmoothedAnimationPrivate *priv)
: QAbstractAnimationJob(), to(0), velocity(200), userDuration(-1), maximumEasingTime(-1),
reversingMode(QQuickSmoothedAnimation::Eased), initialVelocity(0),
trackVelocity(0), initialValue(0), invert(false), finalDuration(-1), lastTime(0),
- useDelta(false), delayedStopTimer(new QSmoothedAnimationTimer(this)), animationTemplate(priv)
+ skipUpdate(false), delayedStopTimer(new QSmoothedAnimationTimer(this)), animationTemplate(priv)
{
delayedStopTimer->setInterval(DELAY_STOP_TIMER_INTERVAL);
delayedStopTimer->setSingleShot(true);
@@ -120,11 +121,11 @@ void QSmoothedAnimation::prepareForRestart()
initialVelocity = trackVelocity;
if (isRunning()) {
//we are joining a new wrapper group while running, our times need to be restarted
- useDelta = true;
+ skipUpdate = true;
init();
lastTime = 0;
} else {
- useDelta = false;
+ skipUpdate = false;
//we'll be started when the group starts, which will force an init()
}
}
@@ -242,12 +243,15 @@ qreal QSmoothedAnimation::easeFollow(qreal time_seconds)
void QSmoothedAnimation::updateCurrentTime(int t)
{
+ if (skipUpdate) {
+ skipUpdate = false;
+ return;
+ }
+
if (!isRunning() && !isPaused()) // This can happen if init() stops the animation in some cases
return;
- qreal time_seconds = useDelta ? qreal(QQmlAnimationTimer::instance()->currentDelta()) / 1000. : qreal(t - lastTime) / 1000.;
- if (useDelta)
- useDelta = false;
+ qreal time_seconds = qreal(t - lastTime) / 1000.;
qreal value = easeFollow(time_seconds);
value *= (invert? -1.0: 1.0);
@@ -403,7 +407,7 @@ QAbstractAnimationJob* QQuickSmoothedAnimation::transition(QQuickStateActions &a
QQuickStateActions dataActions = QQuickPropertyAnimation::createTransitionActions(actions, modified, defaultTarget);
- QParallelAnimationGroupJob *wrapperGroup = new QParallelAnimationGroupJob();
+ QContinuingAnimationGroupJob *wrapperGroup = new QContinuingAnimationGroupJob();
if (!dataActions.isEmpty()) {
QSet<QAbstractAnimationJob*> anims;