diff options
author | Santhosh Kumar <santhosh.kumar.selvaraj@qt.io> | 2024-06-17 21:43:37 +0200 |
---|---|---|
committer | Santhosh Kumar <santhosh.kumar.selvaraj@qt.io> | 2024-06-25 14:43:40 +0000 |
commit | 6bda8fc897b8a4b12720121a45533ef4d2a599da (patch) | |
tree | 47da5c81036f13e2050b029bd78f22f567321436 /tests/auto/quickcontrols/controls/data/tst_swipedelegate.qml | |
parent | 018b34e07bcd9110819fb9f17ba131958c618dd2 (diff) |
The global position used for calculating the drag distance causes an
issue when swipe delegates are placed at different axes. For instance,
a horizontal swipe can remove items even when swipe delegates are placed
vertically. This is because the calculated drag distance will be w.r.t
to the screen coordinates system and not the item coordinate system.
This patch fixes that issue by converting the screen coordinates to item
coordinates when calculating the drag distance.
Fixes: QTBUG-125906
Pick-to: 6.8 6.6 6.7 6.5
Change-Id: If6dd03d43e87386f807ec8bf8c16eb0566b79363
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto/quickcontrols/controls/data/tst_swipedelegate.qml')
-rw-r--r-- | tests/auto/quickcontrols/controls/data/tst_swipedelegate.qml | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/auto/quickcontrols/controls/data/tst_swipedelegate.qml b/tests/auto/quickcontrols/controls/data/tst_swipedelegate.qml index b9dbca5356..ed63f7d39e 100644 --- a/tests/auto/quickcontrols/controls/data/tst_swipedelegate.qml +++ b/tests/auto/quickcontrols/controls/data/tst_swipedelegate.qml @@ -657,6 +657,20 @@ TestCase { width: 100 height: 120 + property int rotation: 0 + + transform: [ + Rotation { + angle: rotation + origin.x: 0 + origin.y: 0 + }, + Translate { + x: (rotation === 90) ? parent.width : 0 + y: 0 + } + ] + model: ListModel { ListElement { name: "Apple" } ListElement { name: "Orange" } @@ -714,15 +728,20 @@ TestCase { function test_removableDelegates_data() { return [ { tag: "mouse", touch: false }, - { tag: "touch", touch: true } + { tag: "touch", touch: true }, + { tag: "mouse_rotation_90", touch: false, rotation: 90 }, + { tag: "touch_rotation_90", touch: true, rotation: 90 }, ] } - function test_removableDelegates() { + function test_removableDelegates(data) { let listView = createTemporaryObject(removableDelegatesComponent, testCase); verify(listView); compare(listView.count, 3); + if (data.rotation) + listView.rotation = data.rotation; + let touch = data.touch ? touchEvent(listView) : null // Expose the remove button. |