diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-09-02 10:42:47 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-09-03 18:43:22 +0200 |
commit | f51b690e91bb2d7c8a03c5cef42abca37d97f8bb (patch) | |
tree | 9ad2f14df7d280ec4b0ade4ba8fb34a24f42e0b1 /src/corelib/animation/qabstractanimation.cpp | |
parent | 21de5aa1ac0255ca0aeaf89db09c2f2beaf33694 (diff) |
Remove timeStep parameter from QAnimationDrive::advanceAnimation
Addresses ### Qt 6 comment, and documentation pointing out that the parameter
value is ignored. It wasn't ignored in the code, but that's the kind of change
we can make now.
With this change, QUnifiedTimer::updateAnimationTimers is only called with -1
as the currentTick input parameter, also from Qt Declarative. Make it default,
so that leaf modules can be fixed. Once that it done, the parameter can be
removed completely.
Change-Id: I80c57ff92f3b615b932dd73d711cf6397347efd8
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/corelib/animation/qabstractanimation.cpp')
-rw-r--r-- | src/corelib/animation/qabstractanimation.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index c0a119f8b3..d1503a294c 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -248,7 +248,7 @@ QUnifiedTimer *QUnifiedTimer::instance() void QUnifiedTimer::maybeUpdateAnimationsToCurrentTime() { if (elapsed() - lastTick > 50) - updateAnimationTimers(-1); + updateAnimationTimers(); } qint64 QUnifiedTimer::elapsed() const @@ -290,13 +290,13 @@ void QUnifiedTimer::stopAnimationDriver() driver->stop(); } -void QUnifiedTimer::updateAnimationTimers(qint64 currentTick) +void QUnifiedTimer::updateAnimationTimers(qint64) { //setCurrentTime can get this called again while we're the for loop. At least with pauseAnimations if(insideTick) return; - qint64 totalElapsed = currentTick > 0 ? currentTick : elapsed(); + const qint64 totalElapsed = elapsed(); // ignore consistentTiming in case the pause timer is active qint64 delta = (consistentTiming && !pauseTimer.isActive()) ? @@ -423,7 +423,7 @@ void QUnifiedTimer::timerEvent(QTimerEvent *event) if (event->timerId() == pauseTimer.timerId()) { // update current time on all timers - updateAnimationTimers(-1); + updateAnimationTimers(); restart(); } } @@ -585,7 +585,7 @@ void QAnimationTimer::ensureTimerUpdate() QAnimationTimer *inst = QAnimationTimer::instance(false); QUnifiedTimer *instU = QUnifiedTimer::instance(false); if (instU && inst && inst->isPaused) - instU->updateAnimationTimers(-1); + instU->updateAnimationTimers(); } void QAnimationTimer::updateAnimationsTime(qint64 delta) @@ -773,23 +773,19 @@ QAnimationDriver::~QAnimationDriver() } /*! - Advances the animation based to the specified \a timeStep. This function should - be continuously called by the driver subclasses while the animation is running. + Advances the animation. This function should be continuously called by + the driver subclasses while the animation is running. - If \a timeStep is positive, it will be used as the current time in the - calculations; otherwise, the current clock time will be used. - - Since 5.4, the timeStep argument is ignored and elapsed() will be - used instead in combination with the internal time offsets of the - animation system. + The calculation of the new current time will use elapsed() in combination + with the internal time offsets of the animation system. */ -void QAnimationDriver::advanceAnimation(qint64 timeStep) +void QAnimationDriver::advanceAnimation() { QUnifiedTimer *instance = QUnifiedTimer::instance(); // update current time on all top level animations - instance->updateAnimationTimers(timeStep); + instance->updateAnimationTimers(); instance->restart(); } @@ -802,7 +798,7 @@ void QAnimationDriver::advanceAnimation(qint64 timeStep) void QAnimationDriver::advance() { - advanceAnimation(-1); + advanceAnimation(); } |