diff options
author | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2009-10-09 14:55:30 (GMT) |
---|---|---|
committer | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2009-10-09 15:40:13 (GMT) |
commit | 9b70924fe2ff5b4bc7246c46a9e3af764bb8bbc8 (patch) | |
tree | fa7c1766f8925576606d575f923fe3d18d5c3d41 /src/corelib/animation/qabstractanimation.cpp | |
parent | b81f1099d84d9be5c99905b506ab86d477cd625b (diff) | |
download | Qt-9b70924fe2ff5b4bc7246c46a9e3af764bb8bbc8.zip Qt-9b70924fe2ff5b4bc7246c46a9e3af764bb8bbc8.tar.gz Qt-9b70924fe2ff5b4bc7246c46a9e3af764bb8bbc8.tar.bz2 |
Update lastTick on all timerTicks in QAbstractAnimation
This is needed in case we change consistentTime while the animation is
running.
Reviewed-by: thierry
Diffstat (limited to 'src/corelib/animation/qabstractanimation.cpp')
-rw-r--r-- | src/corelib/animation/qabstractanimation.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 9e50784..c775a00 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -207,14 +207,10 @@ void QUnifiedTimer::ensureTimerUpdate(QAbstractAnimation *animation) void QUnifiedTimer::updateAnimationsTime() { - // this is simply the time we last received a tick - const int oldLastTick = lastTick; // ignore consistentTiming in case the pause timer is active - if (consistentTiming && !isPauseTimerActive) - lastTick = oldLastTick + timingInterval; - else - lastTick = time.elapsed(); - const int delta = lastTick - oldLastTick; + const int delta = (consistentTiming && !isPauseTimerActive) ? + timingInterval : time.elapsed() - lastTick; + lastTick = time.elapsed(); //we make sure we only call update time if the time has actually changed //it might happen in some cases that the time doesn't change because events are delayed @@ -293,6 +289,7 @@ void QUnifiedTimer::unregisterAnimation(QAbstractAnimation *animation) // this is needed if we unregister an animation while its running if (idx <= currentAnimationIdx) --currentAnimationIdx; + if (animations.isEmpty()) startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, this); } else { |