diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-09-11 16:10:37 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-09-11 17:11:02 +0200 |
commit | 7544c242cb935b5ff625e54c3facceea535c6ae5 (patch) | |
tree | c05f703e4672864896b5211f712952d751163565 /src | |
parent | e0918af700acefd6e80562c051e42d0b64097e1f (diff) | |
download | qtbase-7544c242cb935b5ff625e54c3facceea535c6ae5.tar.gz |
Revert "Remove timeStep parameter from QAnimationDrive::advanceAnimation"
This reverts commit f51b690e91bb2d7c8a03c5cef42abca37d97f8bb.
The commit made all animation tests in qtdeclarative on macOS
flaky.
Change-Id: I4ccaa879df7e2ba7e253657de01cbabc9b2c655f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/animation/qabstractanimation.cpp | 28 | ||||
-rw-r--r-- | src/corelib/animation/qabstractanimation.h | 3 | ||||
-rw-r--r-- | src/corelib/animation/qabstractanimation_p.h | 2 |
3 files changed, 19 insertions, 14 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index d1503a294c..c0a119f8b3 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(); + updateAnimationTimers(-1); } qint64 QUnifiedTimer::elapsed() const @@ -290,13 +290,13 @@ void QUnifiedTimer::stopAnimationDriver() driver->stop(); } -void QUnifiedTimer::updateAnimationTimers(qint64) +void QUnifiedTimer::updateAnimationTimers(qint64 currentTick) { //setCurrentTime can get this called again while we're the for loop. At least with pauseAnimations if(insideTick) return; - const qint64 totalElapsed = elapsed(); + qint64 totalElapsed = currentTick > 0 ? currentTick : 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(); + updateAnimationTimers(-1); 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(); + instU->updateAnimationTimers(-1); } void QAnimationTimer::updateAnimationsTime(qint64 delta) @@ -773,19 +773,23 @@ QAnimationDriver::~QAnimationDriver() } /*! - Advances the animation. This function should be continuously called by - the driver subclasses while the animation is running. + Advances the animation based to the specified \a timeStep. This function should + be continuously called by the driver subclasses while the animation is running. - The calculation of the new current time will use elapsed() in combination - with the internal time offsets of the animation system. + 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. */ -void QAnimationDriver::advanceAnimation() +void QAnimationDriver::advanceAnimation(qint64 timeStep) { QUnifiedTimer *instance = QUnifiedTimer::instance(); // update current time on all top level animations - instance->updateAnimationTimers(); + instance->updateAnimationTimers(timeStep); instance->restart(); } @@ -798,7 +802,7 @@ void QAnimationDriver::advanceAnimation() void QAnimationDriver::advance() { - advanceAnimation(); + advanceAnimation(-1); } diff --git a/src/corelib/animation/qabstractanimation.h b/src/corelib/animation/qabstractanimation.h index 2bb1d52582..ed0a75ea1b 100644 --- a/src/corelib/animation/qabstractanimation.h +++ b/src/corelib/animation/qabstractanimation.h @@ -152,7 +152,8 @@ Q_SIGNALS: void stopped(); protected: - void advanceAnimation(); + // ### Qt6: Remove timestep argument + void advanceAnimation(qint64 timeStep = -1); virtual void start(); virtual void stop(); diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index 0af1925287..037d3be74f 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -185,7 +185,7 @@ public: void restart(); void maybeUpdateAnimationsToCurrentTime(); - void updateAnimationTimers(qint64 = -1); // ### Qt 6 - remove parameter once qtdeclarative is fixed + void updateAnimationTimers(qint64 currentTick); //useful for profiling/debugging int runningAnimationCount(); |