summaryrefslogtreecommitdiffstats
path: root/src/corelib/animation/qabstractanimation.cpp
diff options
context:
space:
mode:
authorAntti Määttä <antti.maatta@qt.io>2021-10-04 12:30:24 +0300
committerAntti Määttä <antti.maatta@qt.io>2021-10-18 20:40:26 +0300
commit9f763a5f3f31d432da5008ba9a8e0b0af36fb27e (patch)
tree0c9430e109c32d328adbe3be9cdd9b8c2f028801 /src/corelib/animation/qabstractanimation.cpp
parentacb86da793c603991da63ba6ab7c6684518d0cd2 (diff)
Allow negative delta for designer animation driver
The designer animation driver needs the ability to drive the animation both forwards and backwards. Pick-to: 6.2 6.2.1 Task-number: QDS-4910 Change-Id: Ie2b1855d062bb254b28b216328cb618d90ee8454 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/animation/qabstractanimation.cpp')
-rw-r--r--src/corelib/animation/qabstractanimation.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index 3e061a0130..1e887bfb54 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -219,7 +219,7 @@ Q_GLOBAL_STATIC(QThreadStorage<QUnifiedTimer *>, unifiedTimer)
QUnifiedTimer::QUnifiedTimer() :
QObject(), defaultDriver(this), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL),
currentAnimationIdx(0), insideTick(false), insideRestart(false), consistentTiming(false), slowMode(false),
- startTimersPending(false), stopTimerPending(false),
+ startTimersPending(false), stopTimerPending(false), allowNegativeDelta(false),
slowdownFactor(5.0f), profilerCallback(nullptr),
driverStartTime(0), temporalDrift(0)
{
@@ -315,7 +315,7 @@ void QUnifiedTimer::updateAnimationTimers()
// when the CPU load is high
//* it might happen in some cases that the delta is negative because the animation driver
// advances faster than time.elapsed()
- if (delta > 0) {
+ if (delta != 0 && (allowNegativeDelta || delta > 0)) {
QScopedValueRollback<bool> guard(insideTick, true);
if (profilerCallback)
profilerCallback(delta);
@@ -517,6 +517,8 @@ void QUnifiedTimer::installAnimationDriver(QAnimationDriver *d)
if (running)
stopAnimationDriver();
driver = d;
+ if (driver)
+ allowNegativeDelta = driver->property("allowNegativeDelta").toBool();
if (running)
startAnimationDriver();
}
@@ -532,6 +534,7 @@ void QUnifiedTimer::uninstallAnimationDriver(QAnimationDriver *d)
if (running)
stopAnimationDriver();
driver = &defaultDriver;
+ allowNegativeDelta = false;
if (running)
startAnimationDriver();
}