From 17237efaefabe924599abe00e92d8b54032d7915 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 8 May 2019 14:56:24 +0200 Subject: Document TapHandler.tapped and [single|double]Tapped eventPoint argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends b8fd580cb3453b3850c36765c4b2537538d2f4f8 to add documentation. The eventPoint is important to get ephemeral state from the pointing device: which button was released (thus triggering the tap), which device it was, and where the release occurred. Users may expect to use the point property, but QQuickHandlerPoint::reset(QQuickEventPoint *) resets every property of the point at the same time, so the architecture currently does not allow for mixed state, i.e. having correct button state but still holding leftover position information. It may be surprising for users, but the changes to the point property are an atomic transaction that occurs before the signal. Task-number: QTBUG-61749 Task-number: QTBUG-64847 Change-Id: I33e0e232084beba8e10d8b02fa3bf85f36293358 Reviewed-by: Jan Arve Sæther --- src/quick/handlers/qquicktaphandler.cpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'src/quick/handlers/qquicktaphandler.cpp') diff --git a/src/quick/handlers/qquicktaphandler.cpp b/src/quick/handlers/qquicktaphandler.cpp index 41ac294df3..73c559c998 100644 --- a/src/quick/handlers/qquicktaphandler.cpp +++ b/src/quick/handlers/qquicktaphandler.cpp @@ -380,35 +380,50 @@ void QQuickTapHandler::updateTimeHeld() */ /*! - \qmlsignal QtQuick::TapHandler::tapped + \qmlsignal QtQuick::TapHandler::tapped(EventPoint eventPoint) This signal is emitted each time the \c parent Item is tapped. That is, if you press and release a touchpoint or button within a time period less than \l longPressThreshold, while any movement does not exceed the drag threshold, then the \c tapped signal will be emitted at the time - of release. + of release. The \c eventPoint signal parameter contains information + from the release event about the point that was tapped: + + \snippet pointerHandlers/tapHandlerOnTapped.qml 0 + + \note At the time this signal is emitted, \l point has been reset + (all coordinates are \c 0). */ /*! - \qmlsignal QtQuick::TapHandler::singleTapped + \qmlsignal QtQuick::TapHandler::singleTapped(EventPoint eventPoint) \since 5.11 This signal is emitted when the \c parent Item is tapped once. After an amount of time greater than QStyleHints::mouseDoubleClickInterval, it can be tapped again; but if the time until the next tap is less, - \l tapCount will increase. + \l tapCount will increase. The \c eventPoint signal parameter contains + information from the release event about the point that was tapped. + + \note At the time this signal is emitted, \l point has been reset + (all coordinates are \c 0). */ /*! - \qmlsignal QtQuick::TapHandler::doubleTapped + \qmlsignal QtQuick::TapHandler::doubleTapped(EventPoint eventPoint) \since 5.11 This signal is emitted when the \c parent Item is tapped twice within a short span of time (QStyleHints::mouseDoubleClickInterval) and distance (QPlatformTheme::MouseDoubleClickDistance or QPlatformTheme::TouchDoubleTapDistance). This signal always occurs after - \l singleTapped, \l tapped, and \l tapCountChanged. + \l singleTapped, \l tapped, and \l tapCountChanged. The \c eventPoint + signal parameter contains information from the release event about the + point that was tapped. + + \note At the time this signal is emitted, \l point has been reset + (all coordinates are \c 0). */ /*! -- cgit v1.2.3