From 8a5001247b250a7f7cb938743481b1405dcdc3a0 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 1 Apr 2019 18:01:41 +0200 Subject: MultiPointHandler: eliminate "no points" warning with native gestures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/quick/handlers/qquickmultipointhandler.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/quick') 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); -- cgit v1.2.3