diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-07-15 12:08:23 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-07-15 20:53:18 +0200 |
commit | eb1bd82f8357cdee875b9d3326b2281314656c4c (patch) | |
tree | db40d08624e564ef5f1a49275a77b8bb3129d00b /src/quick/items/qquickflickable.cpp | |
parent | 1204ed14dc11e6343a569646428a7ffddd098f8c (diff) |
Keep replaying touch press as mouse press after Flickable.pressDelay
In the future, if QQuickFlickable has pressDelay set, and receives a
touch event, we want it to replay the touch after the delay. But in
Qt 5 it can only replay a delayed mouse press, and hacks are in place
to deal with that. We aren't ready to change it all just yet, and
need to keep the autotest working as-is for now.
Task-number: QTBUG-78818
Change-Id: Ib37ccfc2b1b84254f40acac8f8ca8c51c9a88ddf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/quick/items/qquickflickable.cpp')
-rw-r--r-- | src/quick/items/qquickflickable.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index d20f23466b..0a3c1a71c9 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1606,7 +1606,19 @@ void QQuickFlickablePrivate::captureDelayedPress(QQuickItem *item, QMouseEvent * if (!isInnermostPressDelay(item)) return; - delayedPressEvent = QQuickWindowPrivate::cloneMouseEvent(event); + // delayedPressEvent = QQuickWindowPrivate::cloneMouseEvent(event); // TODO make it OK to tell the truth about the device + + // temporary hack to keep the Qt 5 solution for QTBUG-78818 working the same for now: + // when QQuickWindowPrivate::pointerEventInstance() is called, it has to look like a mouse event from a mouse, + // not a mouse event that actually comes from a touchscreen (which is what it actually is). + // Otherwise a nested MultiPointTouchArea will receive a delayed touch + // (which is what we actually want, later on; but the code isn't ready for that yet). + delayedPressEvent = new QMouseEvent(QEvent::MouseButtonPress, event->position(), + event->scenePosition(), event->globalPosition(), event->button(), event->buttons(), + event->modifiers(), Qt::MouseEventSynthesizedByQt); + QMutableSinglePointEvent::from(delayedPressEvent)->setTimestamp(event->timestamp()); + // end of hack + delayedPressEvent->setAccepted(false); delayedPressTimer.start(pressDelay, q); } |