aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
diff options
context:
space:
mode:
authorOliver Eftevaag <oliver.eftevaag@qt.io>2022-12-09 18:40:54 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-12-19 14:56:35 +0000
commit8142a7944f7d4765cfaeddb7bf57edeed36e7b88 (patch)
tree6aef50c233dda9a41a3152f09739addfaeeb409e /tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
parentf456d5311d1c4766a4f633def354d00beec77ca8 (diff)
Flickable: prevent fixup() from being called while dragging
A previous patch 5647527a8cde84b51fff66fc482f02435770b3dd causes a regression. The purpose of the patch, that caused this regression, was to update the pressPos variables, in cases where the contentItem's geometry was modified externally, while a user were dragging the contentItem around. The mistake that was made, was how width and height changes were handled. We had previously added logic in setContentWidth() and setContentHeight() that would call fixup() (with immediate fixupMode) to ensure that the contentItem would immediately be repositioned inside the flickable's viewport, if the contentItem was being dragged. It turns out that setContentWidth() and setContentHeight() are being called from QQuickItemViewPrivate::updateViewport(), which happens quite often, while dragging. This would make fixup() and dragging constantly interfere with each other, since they'd not always agree on a specific position for the contentItem. This patch reverts the changes made to setContentWidth() and setContentHeight(), since it turns out that those changes weren't necessary after all. QQuickFlickablePrivate::itemGeometryChanged() only calls viewportMoved() on x and y changes anyways. Done-with: Jan Arve Sæther <jan-arve.saether@qt.io> Done-with: Santhosh Kumar Selvaraj <santhosh.kumar.selvaraj@qt.io> Fixes: QTBUG-109140 Change-Id: I0bddf8685d3afc1ae04b2c092212d3c1bd742c3b Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit b307bf3c4f63c6e04874a972c747f18e18ddc199) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto/quick/qquickflickable/tst_qquickflickable.cpp')
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index 2fb6abbc3b..ac8e7550bc 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -3041,7 +3041,12 @@ void tst_qquickflickable::setContentPositionWhileDragging() // QTBUG-104966
} else if (newExtent >= 0) {
// ...or reduce the content size be be less than current (contentX, contentY) position
// This forces the content item to move.
- expectedContentPos = moveDelta;
+ // contentY: 150
+ // 320 - 150 = 170 pixels down to bottom
+ // Now reduce contentHeight to 200
+ // since we are at the bottom, and the flickable is 100 pixels tall, contentY must land
+ // at newExtent - 100.
+
if (isHorizontal) {
flickable->setContentWidth(newExtent);
} else {
@@ -3051,6 +3056,7 @@ void tst_qquickflickable::setContentPositionWhileDragging() // QTBUG-104966
// We therefore cannot scroll/flick it further down. Drag it up towards the top instead
// (by moving mouse down).
pos += moveDelta;
+ expectedContentPos = unitDelta * (newExtent - (isHorizontal ? flickable->width() : flickable->height()));
}
QTest::mouseMove(&window, pos);