From 6e6d4927f4620e58bd6acf71a0c6f54513f47c5f Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 24 May 2019 16:36:29 +0200 Subject: Ensure the timeline is updated if frame properties change If the frame number or the easing curve of a frame change, then we have to update the timeline. Change-Id: Id2a1b571727fa5414d62bf0bc549699c28da0dcd Reviewed-by: Tim Jenssen --- src/imports/timeline/qquickkeyframe.cpp | 6 ++++++ tests/auto/qtquicktimeline/tst_qtquicktimeline.cpp | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/imports/timeline/qquickkeyframe.cpp b/src/imports/timeline/qquickkeyframe.cpp index 1736dd2..2e9596b 100644 --- a/src/imports/timeline/qquickkeyframe.cpp +++ b/src/imports/timeline/qquickkeyframe.cpp @@ -173,6 +173,9 @@ void QQuickKeyframe::setFrame(qreal f) if (d->frame == f) return; d->frame = f; + + reset(); + emit frameChanged(); } @@ -375,6 +378,9 @@ void QQuickKeyframe::setEasing(const QEasingCurve &e) return; d->easingCurve = e; + + reset(); + emit easingCurveChanged(); } diff --git a/tests/auto/qtquicktimeline/tst_qtquicktimeline.cpp b/tests/auto/qtquicktimeline/tst_qtquicktimeline.cpp index f366b54..1f71294 100644 --- a/tests/auto/qtquicktimeline/tst_qtquicktimeline.cpp +++ b/tests/auto/qtquicktimeline/tst_qtquicktimeline.cpp @@ -355,6 +355,13 @@ void Tst_QtQuickTimeline::keyframeUpdate() keyframe->setProperty("value", 90); QCOMPARE(keyframe->property("value").toInt(), 90); QCOMPARE(rectangle->property("x").toInt(), 90); + + timeline->setProperty("currentFrame", 60); + QCOMPARE(timeline->property("currentFrame").toInt(), 60); + + QVERIFY(rectangle->property("x").toInt() != 90); + keyframe->setProperty("frame", 60); + QCOMPARE(rectangle->property("x").toInt(), 90); } void Tst_QtQuickTimeline::easingcurveInterpolation() -- cgit v1.2.3