Allow to control animations frame rate from a custom QAnimationDriver

Don't use time from the global timer (QUnifiedTimer::time.elapsed()) for
animations updating when an user overrides QAnimationDriver::elapsed()

Task-number: QTBUG-38390
Change-Id: Ic1470b43d8bbc0ee0a2bbb87f7173f97ba03f852
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
bb10
Timur Artikov 2014-04-17 10:31:39 +07:00 committed by The Qt Project
parent 9f6a0300a5
commit 4833e5080c
1 changed files with 4 additions and 3 deletions

View File

@ -253,8 +253,9 @@ QUnifiedTimer *QUnifiedTimer::instance()
void QUnifiedTimer::maybeUpdateAnimationsToCurrentTime()
{
if (time.elapsed() - lastTick > 50)
updateAnimationTimers(driver->elapsed());
qint64 elapsed = driver->elapsed();
if (elapsed - lastTick > 50)
updateAnimationTimers(elapsed);
}
void QUnifiedTimer::updateAnimationTimers(qint64 currentTick)
@ -263,7 +264,7 @@ void QUnifiedTimer::updateAnimationTimers(qint64 currentTick)
if(insideTick)
return;
qint64 totalElapsed = currentTick >= 0 ? currentTick : time.elapsed();
qint64 totalElapsed = currentTick >= 0 ? currentTick : driver->elapsed();
// ignore consistentTiming in case the pause timer is active
qint64 delta = (consistentTiming && !pauseTimer.isActive()) ?