aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2022-05-03 12:23:18 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2022-05-09 17:19:58 +0000
commit0121c6737c7374d6b21eee4eeed861da2ef77999 (patch)
tree2e43cdfd26d9b87a6aec17275b6f6be2a07722c5 /src/quick/items
parent0e88794676660166aaf327089eaaa1aff902a317 (diff)
MPTA: don't allow more than one touchpoint to react to mouse
On mouse press, if MPTA filters events for a child, addTouchPoint() can be called once during filtering and start reacting to that point, and then called again during direct delivery of the same mouse press. Now it will ignore the second of the declared touchpoint prototypes because the first one is already "taken", and a mouse event can never provide more than one point. Followup to 0012f8bd152a36a67abc696465f27d612625b5d9 Fixes: QTBUG-83662 Change-Id: Ia97600441f0a2633f77b0db9c83cc4de3a9e5931 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 9b64eee22d9e2d40d1283e8844cb1d8899232547) Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index 58ad929b19..480731aee9 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -685,7 +685,7 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event)
emit released(_releasedTouchPoints);
if (moved)
emit updated(_movedTouchPoints);
- if (started)
+ if (started && !_pressedTouchPoints.isEmpty())
emit pressed(_pressedTouchPoints);
if (ended || moved || started) emit touchUpdated(_touchPoints.values());
}
@@ -730,12 +730,15 @@ void QQuickMultiPointTouchArea::addTouchPoint(const QTouchEvent::TouchPoint *p)
void QQuickMultiPointTouchArea::addTouchPoint(const QMouseEvent *e)
{
QQuickTouchPoint *dtp = nullptr;
- for (QQuickTouchPoint *tp : qAsConst(_touchPrototypes))
+ for (QQuickTouchPoint *tp : qAsConst(_touchPrototypes)) {
if (!tp->inUse()) {
tp->setInUse(true);
dtp = tp;
break;
+ } else if (_mouseTouchPoint == tp) {
+ return; // do not allow more than one touchpoint to react to the mouse (QTBUG-83662)
}
+ }
if (dtp == nullptr)
dtp = new QQuickTouchPoint(false);