aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2022-06-28 21:49:59 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-08-26 07:02:57 +0000
commitd54207262d666b2d658e81d8c508ad7b6c984fa6 (patch)
treeaf871335e887268320478ff8bbe937dd717935ff /src/quick
parent7f78e96dfc9789e88ffb06e17a237848753601d2 (diff)
Flickable: don't grab on press if already moving
9f9ea6e1837620a0ff4b98e262cba2df44215967 was too drastic: we cannot simply avoid calling filterPointerEvent() on press, because it calls handlePressEvent() which calls maybeBeginDrag() which sets pressPos, among other things. Failing to set pressPos caused a regression: flicking a second time while the flickable is already moving caused it to "start over" as if it was flicking from the top again. So now we revert that fix, and instead avoid setting stealMouse to true in handlePressEvent(). This makes the second flick more like the first: it waits for move events before taking the exclusive grab; so it's ok for a delegate (such as a Button or MouseArea) to detect the press and take a grab in the meantime. Flickable does not need to grab on press during filtering: it's not a lost opportunity, because it keeps filtering its children's events later on anyway. The flickDuringFlicking() test is added for this scenario. For the same reason as tapDelegateDuringFlicking(), this is also likely to fail on Android for now. This could have some impact on d7b5a485583004ad6a1374a50b7c3f6cab00aca3 but it seems the test that was added there still passes. Fixes: QTBUG-103832 Task-number: QTBUG-38765 Task-number: QTBUG-74842 Task-number: QTBUG-104471 Change-Id: Icb45fcd94847051121ee78a970fbd5f5dc8a42a4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Antti Määttä <antti.maatta@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> (cherry picked from commit bb337a0e1c22896984438cbd51ab7473807f017c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/items/qquickflickable.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index ea48afb652..5fd8aac232 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -2582,7 +2582,9 @@ bool QQuickFlickable::filterPointerEvent(QQuickItem *receiver, QPointerEvent *ev
case QEventPoint::State::Pressed:
d->handlePressEvent(localizedEvent.data());
d->captureDelayedPress(receiver, event);
- stealThisEvent = d->stealMouse; // Update stealThisEvent in case changed by handlePressEvent
+ // never grab the pointing device on press during filtering: do it later, during a move
+ d->stealMouse = false;
+ stealThisEvent = false;
break;
case QEventPoint::State::Released:
d->handleReleaseEvent(localizedEvent.data());
@@ -2637,7 +2639,6 @@ bool QQuickFlickable::childMouseEventFilter(QQuickItem *i, QEvent *e)
};
if (!isVisible() || !isEnabled() || !isInteractive() ||
- (pointerEvent && isMoving() && pointerEvent->isBeginEvent()) ||
(pointerEvent && !wantsPointerEvent_helper())) {
d->cancelInteraction();
return QQuickItem::childMouseEventFilter(i, e);