diff options
author | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2010-06-30 11:59:30 (GMT) |
---|---|---|
committer | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2010-06-30 12:49:11 (GMT) |
commit | f141de3daa267c266f67def765adb934138db080 (patch) | |
tree | b79a602ad210f65f15f44f31ba3f3bc6bae0c784 /src/corelib/animation/qabstractanimation.cpp | |
parent | 176024dfea7d354451a65b61fa2e82dd422b4dfb (diff) | |
download | Qt-f141de3daa267c266f67def765adb934138db080.zip Qt-f141de3daa267c266f67def765adb934138db080.tar.gz Qt-f141de3daa267c266f67def765adb934138db080.tar.bz2 |
Adds slowdownFactor to UnifiedTimer in abstract animation
The slowdown factor is useful for debugging complex animations.
Setting it to 0 will stop all animations when slowMode is enabled.
Submitted-by: Lasse
Reviewed-by: Thierry
Diffstat (limited to 'src/corelib/animation/qabstractanimation.cpp')
-rw-r--r-- | src/corelib/animation/qabstractanimation.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 04342e7..7feb3f7 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -168,7 +168,7 @@ Q_GLOBAL_STATIC(QThreadStorage<QUnifiedTimer *>, unifiedTimer) QUnifiedTimer::QUnifiedTimer() : QObject(), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL), currentAnimationIdx(0), consistentTiming(false), slowMode(false), - isPauseTimerActive(false), runningLeafAnimations(0) + slowdownFactor(5.0f), isPauseTimerActive(false), runningLeafAnimations(0) { time.invalidate(); } @@ -208,8 +208,13 @@ void QUnifiedTimer::updateAnimationsTime() // ignore consistentTiming in case the pause timer is active int delta = (consistentTiming && !isPauseTimerActive) ? timingInterval : time.elapsed() - lastTick; - if (slowMode) - delta /= 5; + if (slowMode) { + if (slowdownFactor > 0) + delta = qRound(delta / slowdownFactor); + else + delta = 0; + } + lastTick = time.elapsed(); //we make sure we only call update time if the time has actually changed |