summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-12 17:14:41 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-13 08:44:42 +0200
commit044231c4d284f5d22694a4ed9d0ee75d17e8dda8 (patch)
treec3a32c73a5271af831209243c100de64f57346c4
parent4e10abb4c14df2ffc162a0eb017229dfa2bab1fb (diff)
Remove timeStep parameter from QAnimationDrive::advanceAnimation
This reverts commit 7544c242cb935b5ff625e54c3facceea535c6ae5, which reverted the first removal of the parameter under the assumption that it caused flakiness in tests. The flakiness was instead caused by changes to the wait functions in QTest, so remove the parameter again. Change-Id: I98154d5d7268375aebbcb09de757e75d9b765c5f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--src/corelib/animation/qabstractanimation.cpp28
-rw-r--r--src/corelib/animation/qabstractanimation.h3
-rw-r--r--src/corelib/animation/qabstractanimation_p.h2
-rw-r--r--tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp4
4 files changed, 16 insertions, 21 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();
}
diff --git a/src/corelib/animation/qabstractanimation.h b/src/corelib/animation/qabstractanimation.h
index ed0a75ea1b..2bb1d52582 100644
--- a/src/corelib/animation/qabstractanimation.h
+++ b/src/corelib/animation/qabstractanimation.h
@@ -152,8 +152,7 @@ Q_SIGNALS:
void stopped();
protected:
- // ### Qt6: Remove timestep argument
- void advanceAnimation(qint64 timeStep = -1);
+ void advanceAnimation();
virtual void start();
virtual void stop();
diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h
index 037d3be74f..0af1925287 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 currentTick);
+ void updateAnimationTimers(qint64 = -1); // ### Qt 6 - remove parameter once qtdeclarative is fixed
//useful for profiling/debugging
int runningAnimationCount();
diff --git a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
index f5cff8a2e0..ada5d29f5c 100644
--- a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
+++ b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
@@ -115,10 +115,10 @@ public:
static const int interval = 1000/60;
qint64 until = m_elapsed + ms;
while (m_elapsed < until) {
- advanceAnimation(m_elapsed);
+ advanceAnimation();
m_elapsed += interval;
}
- advanceAnimation(m_elapsed);
+ advanceAnimation();
// This is to make sure that animations that were started with DeleteWhenStopped
// will actually delete themselves within the test function.
// Normally, they won't be deleted until the main event loop is processed.