From f100f84703e829e162e5c05203d7c96939ad616a Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 11 Jun 2012 12:27:05 +0300 Subject: [PATCH] Clarify QTouchEvent docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mention something about touch handling with QWindow and document the non-partialness of touch events which has been taken for granted since 4.6, but has not been documented at all. Change-Id: I9ec75f74153bbc28e146b000d70fb26384e497a3 Reviewed-by: Samuel Rødal --- src/gui/kernel/qevent.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 4782fa5f49..0ea32f3127 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3292,6 +3292,9 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent() QEvent::TouchCancel. Reimplement QWidget::event() or QAbstractScrollArea::viewportEvent() for widgets and QGraphicsItem::sceneEvent() for items in a graphics view to receive touch events. + Unlike widgets, QWindows receive touch events always, there is no need to opt in. When working + directly with a QWindow, it is enough to reimplement QWindow::touchEvent(). + The QEvent::TouchUpdate and QEvent::TouchEnd events are sent to the widget or item that accepted the QEvent::TouchBegin event. If the QEvent::TouchBegin event is not accepted and not filtered by an event filter, then no further touch events are sent until the next @@ -3308,6 +3311,12 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent() each touch point can be retrieved using the QTouchEvent::TouchPoint class. The Qt::TouchPointState enum describes the different states that a touch point may have. + \note The list of touchPoints() will never be partial: A touch event will always contain a touch + point for each existing physical touch contacts targetting the window or widget to which the + event is sent. For instance, assuming that all touches target the same window or widget, an + event with a condition of touchPoints().count()==2 is guaranteed to imply that the number of + fingers touching the touchscreen or touchpad is exactly two. + \section1 Event Delivery and Propagation By default, QGuiApplication translates the first touch point in a QTouchEvent into