aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/animations
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2022-04-08 17:45:41 +0800
committerMitch Curtis <mitch.curtis@qt.io>2022-04-28 12:12:50 +0800
commit44dd79eedae174af3474f6317327a09af0de177a (patch)
tree93377fb97dba547d2dfaa9fef4bfff5acbf1b05e /src/qml/animations
parent7b827225f2a5a28fea42d7e0c2113182f510ed3e (diff)
Allow modifying from, to, duration and easing properties during animation
The main motivation for this is convenience, but it also allows controls to respond to resizing for items that have animations without resorting to JavaScript to call restart(). [ChangeLog][QtQuick] It is now possible to set the from, to, duration, and easing properties of a top-level animation while it is running. The animation will take the changes into account on the next loop. Change-Id: I2f560ee713666e67b7162d95ff28621fcf3b2545 Fixes: QTBUG-38932 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/qml/animations')
-rw-r--r--src/qml/animations/qabstractanimationjob.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/qml/animations/qabstractanimationjob.cpp b/src/qml/animations/qabstractanimationjob.cpp
index 05cf786e7d..b547129d33 100644
--- a/src/qml/animations/qabstractanimationjob.cpp
+++ b/src/qml/animations/qabstractanimationjob.cpp
@@ -514,8 +514,11 @@ void QAbstractAnimationJob::setCurrentTime(int msecs)
RETURN_IF_DELETED(updateCurrentTime(m_currentTime));
- if (m_currentLoop != oldLoop)
- currentLoopChanged();
+ if (m_currentLoop != oldLoop) {
+ // CurrentLoop listeners may restart the job if e.g. from has changed. Stopping a job will
+ // destroy it, so account for that here.
+ RETURN_IF_DELETED(currentLoopChanged());
+ }
// All animations are responsible for stopping the animation when their
// own end state is reached; in this case the animation is time driven,