aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2019-05-24 16:36:29 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2019-05-24 16:36:29 +0200
commit6e6d4927f4620e58bd6acf71a0c6f54513f47c5f (patch)
treec2ef245f6f4bea0064983af4b3b577e259c622e4
parent0cfb29c88901e8b69ffdb996fc4ea7ba1098e033 (diff)
Ensure the timeline is updated if frame properties changev1.0.01.0
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 <tim.jenssen@qt.io>
-rw-r--r--src/imports/timeline/qquickkeyframe.cpp6
-rw-r--r--tests/auto/qtquicktimeline/tst_qtquicktimeline.cpp7
2 files changed, 13 insertions, 0 deletions
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()