diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-04-01 18:01:41 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-04-26 17:53:17 +0000 |
commit | 8a5001247b250a7f7cb938743481b1405dcdc3a0 (patch) | |
tree | 0f93996a3df1c822fe0821a5c707d3ebdfa48128 | |
parent | dbbbbe569da0aa3900a17ca22bd2be2708fb76f7 (diff) |
MultiPointHandler: eliminate "no points" warning with native gestures
In handlePointerEventImpl, there is the call
d->centroid.reset(d->currentPoints);
with the expectation that currentPoints is not empty. But we weren't
populating it in case of a native gesture.
It still ends up being empty at the end of the gesture, but it's
normal to return false from wantsPointerEvent() when there are no
eligible points.
Fixes: QTBUG-70083
Change-Id: I12ca6460a24d2eb6c44a639f83ce3ff17eb37613
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
-rw-r--r-- | src/quick/handlers/qquickmultipointhandler.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/quick/handlers/qquickmultipointhandler.cpp b/src/quick/handlers/qquickmultipointhandler.cpp index baa68e5e53..6fbab29077 100644 --- a/src/quick/handlers/qquickmultipointhandler.cpp +++ b/src/quick/handlers/qquickmultipointhandler.cpp @@ -70,14 +70,15 @@ bool QQuickMultiPointHandler::wantsPointerEvent(QQuickPointerEvent *event) if (!QQuickPointerDeviceHandler::wantsPointerEvent(event)) return false; -#if QT_CONFIG(gestures) - if (event->asPointerNativeGestureEvent()) - return true; -#endif - if (event->asPointerScrollEvent()) return false; + bool ret = false; +#if QT_CONFIG(gestures) + if (event->asPointerNativeGestureEvent() && event->point(0)->state() != QQuickEventPoint::Released) + ret = true; +#endif + // If points were pressed or released within parentItem, reset stored state // and check eligible points again. This class of handlers is intended to // handle a specific number of points, so a differing number of points will @@ -97,7 +98,7 @@ bool QQuickMultiPointHandler::wantsPointerEvent(QQuickPointerEvent *event) return true; } - const bool ret = (candidatePoints.size() >= minimumPointCount() && candidatePoints.size() <= maximumPointCount()); + ret = ret || (candidatePoints.size() >= minimumPointCount() && candidatePoints.size() <= maximumPointCount()); if (ret) { const int c = candidatePoints.count(); m_currentPoints.resize(c); |