diff options
author | Bumjoon Park <bumjoon.park@qt.io> | 2022-06-22 15:36:47 +0900 |
---|---|---|
committer | Bumjoon Park <bumjoon.park@qt.io> | 2022-07-07 01:35:22 +0000 |
commit | 572b3ae9f32d039ed2b14a50731e939422646da4 (patch) | |
tree | baf4d34b966549d9cb4050b9d2d49d7e1b8609de | |
parent | 1d93816ac248f370db7a523bcdd92f95c057271a (diff) |
Delete transition when it's canceled
If next transition occurs before previous transition ends, the
animation of the previous transition is canceled. The problem is
that it is not removed from A while it is being canceled.
At this time, if a new job comes in translator->runningJobs,'busy'
state cannot return back to its original state and mouseEvent/
touchEvent are broken.
So, in case of transition canceled, we should remove the transition.
Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-104491
Change-Id: I33083822763bdc006eb35262b9c216f27989139a
Reviewed-by: Bumjoon Park <bumjoon.park@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
-rw-r--r-- | src/quick/items/qquickitemviewtransition.cpp | 2 | ||||
-rw-r--r-- | tests/auto/quickcontrols2/controls/data/tst_stackview.qml | 33 |
2 files changed, 35 insertions, 0 deletions
diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp index 0da4959cb8..b8cf6c3180 100644 --- a/src/quick/items/qquickitemviewtransition.cpp +++ b/src/quick/items/qquickitemviewtransition.cpp @@ -545,6 +545,8 @@ void QQuickItemViewTransitionableItem::stopTransition() { if (transition) RETURN_IF_DELETED(transition->cancel()); + delete transition; + transition = nullptr; clearCurrentScheduledTransition(); resetNextTransitionPos(); } diff --git a/tests/auto/quickcontrols2/controls/data/tst_stackview.qml b/tests/auto/quickcontrols2/controls/data/tst_stackview.qml index cfe429e087..f2a3781fb1 100644 --- a/tests/auto/quickcontrols2/controls/data/tst_stackview.qml +++ b/tests/auto/quickcontrols2/controls/data/tst_stackview.qml @@ -1511,4 +1511,37 @@ TestCase { verify(control.currentItem.i === 42) control.pop(StackView.Immediate) } + + // QTBUG-104491 + // Tests that correctly set a busy state when the transition is stolen(canceled) + function test_continuousTransition() { + let redRect = createTemporaryObject(rectangleComponent, testCase, { color: "red" }) + verify(redRect) + let blueRect = createTemporaryObject(rectangleComponent, testCase, { color: "blue" }) + verify(blueRect) + let greenRect = createTemporaryObject(rectangleComponent, testCase, { color: "green" }) + verify(greenRect) + let yellowRect = createTemporaryObject(rectangleComponent, testCase, { color: "yellow" }) + verify(yellowRect) + let control = createTemporaryObject(qtbug96966_stackViewComponent, testCase, + { "anchors.fill": testCase, initialItem: redRect }) + verify(control) + + control.push(blueRect) + control.pop() + tryCompare(control, "busy", true) + tryCompare(control, "busy", false) + + control.push(blueRect) + control.push(greenRect) + control.push(yellowRect) + tryCompare(control, "busy", true) + tryCompare(control, "busy", false) + + control.pop() + control.pop() + control.pop() + tryCompare(control, "busy", true) + tryCompare(control, "busy", false) + } } |