|
|
50d94e |
From 743ae2a4d59eccc4720390c4c757b081eb2c6bfa Mon Sep 17 00:00:00 2001
|
|
|
50d94e |
From: =?UTF-8?q?Jan=20Arve=20S=C3=A6ther?= <jan-arve.saether@qt.io>
|
|
|
50d94e |
Date: Thu, 3 Sep 2020 10:51:01 +0200
|
|
|
50d94e |
Subject: [PATCH 15/20] Fix TapHandler so that it actually registers a tap
|
|
|
50d94e |
|
|
|
50d94e |
This bug caused all quick examples that used the
|
|
|
50d94e |
shared\LauncherList.qml to be broken.
|
|
|
50d94e |
|
|
|
50d94e |
In QtGui, QSinglePointEvent will construct itself with a point id of 0
|
|
|
50d94e |
if there is a valid point, and with a point id of -1 if the point is
|
|
|
50d94e |
invalid (the default constructor does the latter).
|
|
|
50d94e |
However, QQuickSinglePointHandler::wantsPointerEvent() did not agree
|
|
|
50d94e |
with that, because it assumed that a point id of 0 meant
|
|
|
50d94e |
uninitialized/invalid point.
|
|
|
50d94e |
The fix is to change QQuickSinglePointHandler::wantsPointerEvent() and
|
|
|
50d94e |
QQuickHandlerPoint so that it assumes that the id -1 is now an invalid
|
|
|
50d94e |
point, (instead of 0)
|
|
|
50d94e |
|
|
|
50d94e |
Change-Id: I8c9683dfe06ebb77c5342a26f08174b67e7cbd90
|
|
|
50d94e |
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
|
|
|
50d94e |
(cherry picked from commit 8d3a91016506fd0afedb0be535f7c34a4ca762f6)
|
|
|
50d94e |
---
|
|
|
50d94e |
src/quick/handlers/qquickhandlerpoint.cpp | 4 ++--
|
|
|
50d94e |
src/quick/handlers/qquicksinglepointhandler.cpp | 4 ++--
|
|
|
50d94e |
2 files changed, 4 insertions(+), 4 deletions(-)
|
|
|
50d94e |
|
|
|
50d94e |
diff --git a/src/quick/handlers/qquickhandlerpoint.cpp b/src/quick/handlers/qquickhandlerpoint.cpp
|
|
|
50d94e |
index 72efdfd0f4..6aef3545dd 100644
|
|
|
50d94e |
--- a/src/quick/handlers/qquickhandlerpoint.cpp
|
|
|
50d94e |
+++ b/src/quick/handlers/qquickhandlerpoint.cpp
|
|
|
50d94e |
@@ -82,7 +82,7 @@ void QQuickHandlerPoint::localize(QQuickItem *item)
|
|
|
50d94e |
|
|
|
50d94e |
void QQuickHandlerPoint::reset()
|
|
|
50d94e |
{
|
|
|
50d94e |
- m_id = 0;
|
|
|
50d94e |
+ m_id = -1;
|
|
|
50d94e |
m_uniqueId = QPointingDeviceUniqueId();
|
|
|
50d94e |
m_position = QPointF();
|
|
|
50d94e |
m_scenePosition = QPointF();
|
|
|
50d94e |
@@ -165,7 +165,7 @@ void QQuickHandlerPoint::reset(const QVector<QQuickHandlerPoint> &points)
|
|
|
50d94e |
pressureSum += point.pressure();
|
|
|
50d94e |
ellipseDiameterSum += point.ellipseDiameters();
|
|
|
50d94e |
}
|
|
|
50d94e |
- m_id = 0;
|
|
|
50d94e |
+ m_id = -1;
|
|
|
50d94e |
m_uniqueId = QPointingDeviceUniqueId();
|
|
|
50d94e |
// all points are required to be from the same event, so pressed buttons and modifiers should be the same
|
|
|
50d94e |
m_pressedButtons = points.first().pressedButtons();
|
|
|
50d94e |
diff --git a/src/quick/handlers/qquicksinglepointhandler.cpp b/src/quick/handlers/qquicksinglepointhandler.cpp
|
|
|
50d94e |
index b51f53b74f..89081b4e84 100644
|
|
|
50d94e |
--- a/src/quick/handlers/qquicksinglepointhandler.cpp
|
|
|
50d94e |
+++ b/src/quick/handlers/qquicksinglepointhandler.cpp
|
|
|
50d94e |
@@ -75,7 +75,7 @@ bool QQuickSinglePointHandler::wantsPointerEvent(QQuickPointerEvent *event)
|
|
|
50d94e |
if (!QQuickPointerDeviceHandler::wantsPointerEvent(event))
|
|
|
50d94e |
return false;
|
|
|
50d94e |
|
|
|
50d94e |
- if (d->pointInfo.id()) {
|
|
|
50d94e |
+ if (d->pointInfo.id() != -1) {
|
|
|
50d94e |
// We already know which one we want, so check whether it's there.
|
|
|
50d94e |
// It's expected to be an update or a release.
|
|
|
50d94e |
// If we no longer want it, cancel the grab.
|
|
|
50d94e |
@@ -125,7 +125,7 @@ bool QQuickSinglePointHandler::wantsPointerEvent(QQuickPointerEvent *event)
|
|
|
50d94e |
chosen->setAccepted();
|
|
|
50d94e |
}
|
|
|
50d94e |
}
|
|
|
50d94e |
- return d->pointInfo.id();
|
|
|
50d94e |
+ return d->pointInfo.id() != -1;
|
|
|
50d94e |
}
|
|
|
50d94e |
|
|
|
50d94e |
void QQuickSinglePointHandler::handlePointerEventImpl(QQuickPointerEvent *event)
|
|
|
50d94e |
--
|
|
|
50d94e |
2.35.1
|
|
|
50d94e |
|