diff options
-rw-r--r-- | src/quick/handlers/qquickpinchhandler.cpp | 5 | ||||
-rw-r--r-- | tests/manual/pointer/pinchHandler.qml | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/quick/handlers/qquickpinchhandler.cpp b/src/quick/handlers/qquickpinchhandler.cpp index e1e4feae1a..bdacc6f46d 100644 --- a/src/quick/handlers/qquickpinchhandler.cpp +++ b/src/quick/handlers/qquickpinchhandler.cpp @@ -92,7 +92,7 @@ Q_LOGGING_CATEGORY(lcPinchHandler, "qt.quick.handler.pinch") but if it's a disallowed number, it does not scale or rotate its \l target, and the \l active property remains \c false. - \sa PinchArea, QPointerEvent::pointCount() + \sa PinchArea, QPointerEvent::pointCount(), QNativeGestureEvent::fingerCount() */ QQuickPinchHandler::QQuickPinchHandler(QQuickItem *parent) @@ -170,7 +170,8 @@ bool QQuickPinchHandler::wantsPointerEvent(QPointerEvent *event) #if QT_CONFIG(gestures) if (event->type() == QEvent::NativeGesture) { const auto gesture = static_cast<const QNativeGestureEvent *>(event); - if (minimumPointCount() == 2) { + if (!gesture->fingerCount() || (gesture->fingerCount() >= minimumPointCount() && + gesture->fingerCount() <= maximumPointCount())) { switch (gesture->gestureType()) { case Qt::BeginNativeGesture: case Qt::EndNativeGesture: diff --git a/tests/manual/pointer/pinchHandler.qml b/tests/manual/pointer/pinchHandler.qml index 93169da60a..e7f4530c4c 100644 --- a/tests/manual/pointer/pinchHandler.qml +++ b/tests/manual/pointer/pinchHandler.qml @@ -65,10 +65,11 @@ Rectangle { minimumScale: 0.5 maximumScale: 3 minimumPointCount: 3 + maximumPointCount: 6 // mutants are allowed; using both hands is not normal for a pinch gesture, but we can't tell } Text { - text: "Pinch with 3 fingers to scale, rotate and translate" + text: "Pinch with 3 or more fingers to scale, rotate and translate" + getTransformationDetails(parent, grandparentPinch) } |