From d5364954e6b2717e21c0afa5db5d1a0bb3bff5a2 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 27 Feb 2018 16:12:24 +0100 Subject: doc: Improve the Input Handlers index page - Document the exclusive/passive grab concepts better - Mention gesturePolicy's impact on grab behavior in the TapHandler docs too - More links - Add a couple of snippets illustrating simple use cases with handlers - Don't bother mentioning Qt.labs.handlers anymore Task-number: QTBUG-68110 Change-Id: I5e6f538c2bc8cafef679f535a5248b218b4a8068 Reviewed-by: Paul Wicking (cherry picked from commit aade6857d12b2c9cd5552d25f4d084a5fcd25f7d) Reviewed-by: Qt Cherry-pick Bot --- src/quick/handlers/qquicktaphandler.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/quick/handlers/qquicktaphandler.cpp') diff --git a/src/quick/handlers/qquicktaphandler.cpp b/src/quick/handlers/qquicktaphandler.cpp index 52e84aa649..04c9558e0a 100644 --- a/src/quick/handlers/qquicktaphandler.cpp +++ b/src/quick/handlers/qquicktaphandler.cpp @@ -209,6 +209,8 @@ void QQuickTapHandler::timerEvent(QTimerEvent *event) If the spatial constraint is violated, \l pressed transitions immediately from true to false, regardless of the time held. + The \c gesturePolicy also affects grab behavior as described below. + \value TapHandler.DragThreshold (the default value) The event point must not move significantly. If the mouse, finger or stylus moves past the system-wide drag @@ -217,11 +219,13 @@ void QQuickTapHandler::timerEvent(QTimerEvent *event) can be useful whenever TapHandler needs to cooperate with other input handlers (for example \l DragHandler) or event-handling Items (for example QtQuick Controls), because in this case TapHandler - will not take the exclusive grab, but merely a passive grab. + will not take the exclusive grab, but merely a + \l {QPointerEvent::addPassiveGrabber()}{passive grab}. \value TapHandler.WithinBounds If the event point leaves the bounds of the \c parent Item, the tap - gesture is canceled. The TapHandler will take the exclusive grab on + gesture is canceled. The TapHandler will take the + \l {QPointerEvent::setExclusiveGrabber}{exclusive grab} on press, but will release the grab as soon as the boundary constraint is no longer satisfied. @@ -232,8 +236,9 @@ void QQuickTapHandler::timerEvent(QTimerEvent *event) typical behavior for button widgets: you can cancel a click by dragging outside the button, and you can also change your mind by dragging back inside the button before release. Note that it's - necessary for TapHandler take the exclusive grab on press and retain - it until release in order to detect this gesture. + necessary for TapHandler to take the + \l {QPointerEvent::setExclusiveGrabber}{exclusive grab} on press + and retain it until release in order to detect this gesture. */ void QQuickTapHandler::setGesturePolicy(QQuickTapHandler::GesturePolicy gesturePolicy) { -- cgit v1.2.3