diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-10-26 22:31:45 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-11-26 11:24:22 +0100 |
commit | 0012f8bd152a36a67abc696465f27d612625b5d9 (patch) | |
tree | a48fd0c4ffc5fa5750eef28f80c3b97064008b45 /src/quick/items/qquickmultipointtoucharea_p.h | |
parent | 9248166095b1e3383a43f106219e888b6d43b7d6 (diff) |
MultiPointTouchArea: stop ignoring Qt-synthesized mouse events
We ignored them because we assume that if a touch event is sent first,
the MultiPointTouchArea will handle it; and then if a synth-mouse event
is sent afterwards for some reason, it's irrelevant to MPTA. However:
1) A synth-mouse event should not actually be sent, because MPTA accepts
the touch event. 2) If Flickable is used with pressDelay set, Flickable
will send the delayed press in the form of a mouse event (it does not
know how to replay a touch event at all). So if MPTA is used in a
ListView delegate for example, it's necessary for MPTA to react to a
synth-mouse event during replay. In both the press delay replay
and QTabletEvent scenarios, the mouse event has source() set to
MouseEventSynthesizedByQt, so MPTA needs to handle those events.
After a synth-mouse event during replay, MPTA can still receive an
actual touch release, which thoroughly confuses its pre-existing logic.
In that case it helps to check whether the touchpoint ID is the same as
QQuickWindowPrivate::touchMouseId, handle the release of that point, and
also release the internal synthetic _mouseQpaTouchPoint which was
remembered from the mouse press.
Fixes: QTBUG-75750
Fixes: QTBUG-78818
Change-Id: I8149f8b05f00677eb07a2f09b725b1db5f95b122
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/items/qquickmultipointtoucharea_p.h')
-rw-r--r-- | src/quick/items/qquickmultipointtoucharea_p.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h index 634ea1c2e2..23f4ebff75 100644 --- a/src/quick/items/qquickmultipointtoucharea_p.h +++ b/src/quick/items/qquickmultipointtoucharea_p.h @@ -284,7 +284,7 @@ protected: #endif private: - void ungrab(); + void ungrab(bool normalRelease = false); QMap<int,QQuickTouchPoint*> _touchPrototypes; //TouchPoints defined in QML QMap<int,QObject*> _touchPoints; //All current touch points QList<QObject*> _releasedTouchPoints; @@ -292,8 +292,10 @@ private: QList<QObject*> _movedTouchPoints; int _minimumTouchPoints; int _maximumTouchPoints; + QVector<int> _lastFilterableTouchPointIds; QPointer<QQuickTouchPoint> _mouseTouchPoint; // exists when mouse button is down and _mouseEnabled is true; null otherwise QTouchEvent::TouchPoint _mouseQpaTouchPoint; // synthetic QPA touch point to hold state and position of the mouse + const QTouchDevice *_touchMouseDevice; QPointF _mousePos; bool _stealMouse; bool _mouseEnabled; |