aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickwindow.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2016-07-29 15:09:56 +0200
committerFrederik Gladhorn <frederik.gladhorn@qt.io>2016-07-29 19:48:30 +0000
commit397588a9f68886608d2d257f70178ffc1b79e6ae (patch)
treec72d498ed1671e3a7c92105154c38e0b18b76405 /src/quick/items/qquickwindow.cpp
parent93ed9cca8fdd21f9ecb26a3484b8b1507ab2b7b5 (diff)
Touch event delivery: split into press and update delivery
This gets rid of iterating through all possible receivers when touch events get delivered, the event gets sent directly to the right item. Change-Id: I341bbdc095744a99c6c4011f07d5f5a239b7fe46 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'src/quick/items/qquickwindow.cpp')
-rw-r--r--src/quick/items/qquickwindow.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index e3c80a8638..378b21c8cc 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -2175,7 +2175,10 @@ void QQuickWindowPrivate::deliverTouchEvent(QQuickPointerTouchEvent *event)
qCDebug(DBG_TOUCH) << " - delivering" << event->asTouchEvent();
QSet<QQuickItem *> hasFiltered;
- deliverPoints(contentItem, event, &hasFiltered);
+ if (event->isPressEvent())
+ deliverNewTouchPoints(contentItem, event, &hasFiltered);
+ if (!event->allPointsAccepted())
+ deliverUpdatedTouchPoints(event, &hasFiltered);
// Remove released points from itemForTouchPointId
bool allReleased = true;
@@ -2202,8 +2205,18 @@ void QQuickWindowPrivate::deliverTouchEvent(QQuickPointerTouchEvent *event)
}
}
+// Deliver touch points to existing grabbers
+bool QQuickWindowPrivate::deliverUpdatedTouchPoints(QQuickPointerTouchEvent *event, QSet<QQuickItem *> *hasFiltered)
+{
+ for (auto grabber: event->grabbers()) {
+ deliverMatchingPointsToItem(grabber, event, hasFiltered);
+ }
+
+ return false;
+}
+
// This function recurses and sends the events to the individual items
-bool QQuickWindowPrivate::deliverPoints(QQuickItem *item, QQuickPointerTouchEvent *event, QSet<QQuickItem *> *hasFiltered)
+bool QQuickWindowPrivate::deliverNewTouchPoints(QQuickItem *item, QQuickPointerTouchEvent *event, QSet<QQuickItem *> *hasFiltered)
{
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
@@ -2214,7 +2227,7 @@ bool QQuickWindowPrivate::deliverPoints(QQuickItem *item, QQuickPointerTouchEven
QQuickItem *child = children.at(ii);
if (!child->isEnabled() || !child->isVisible() || QQuickItemPrivate::get(child)->culled)
continue;
- if (deliverPoints(child, event, hasFiltered))
+ if (deliverNewTouchPoints(child, event, hasFiltered))
return true;
}
@@ -2272,7 +2285,7 @@ bool QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, const QQ
if (touchEventAccepted) {
// If the touch was accepted (regardless by whom or in what form),
- // update acceptedNewPoints.
+ // update accepted new points.
for (auto point: qAsConst(touchEvent->touchPoints())) {
auto pointerEventPoint = event->pointById(point.id());
pointerEventPoint->setAccepted();