diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-06-14 15:18:44 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-06-25 15:48:01 +0000 |
commit | 6c8d844eb57a95b3ca6b802a76d9db927051229f (patch) | |
tree | 0611ca744fbb39b814c3d8c565e628d5c1b3f595 /src/quick/handlers/qquickmultipointhandler.cpp | |
parent | 961b20eee85d81a0afa2ae08d02456a36d2325e9 (diff) |
MultiPointHandler::hasCurrentPoints: OK if event has more points
We plan for DragHandler to be able to handle multiple points and thus
to inherit from MultiPointHandler. But most DragHandlers only handle
single points. Without this change, the mixer manual test would be
broken: each DragHandler's m_currentPoints will have only one point,
but as soon as the event has multiple points, all the DragHandlers
would return false from wantsPointerEvent, and therefore it becomes
impossible to drag two DragHandlers with two fingers.
This test was just meant as a shortcut/optimization anyway.
But if the event contains fewer points than the handler already knows
that it wants to handle, we can still return early.
Change-Id: Ieea26a09bb9af9ee3c7ff2913f8e90f35c0f070e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/handlers/qquickmultipointhandler.cpp')
-rw-r--r-- | src/quick/handlers/qquickmultipointhandler.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/quick/handlers/qquickmultipointhandler.cpp b/src/quick/handlers/qquickmultipointhandler.cpp index 89733a4260..a074e966aa 100644 --- a/src/quick/handlers/qquickmultipointhandler.cpp +++ b/src/quick/handlers/qquickmultipointhandler.cpp @@ -81,7 +81,7 @@ bool QQuickMultiPointHandler::wantsPointerEvent(QQuickPointerEvent *event) return true; #endif - if (sameAsCurrentPoints(event)) + if (hasCurrentPoints(event)) return true; const QVector<QQuickEventPoint *> candidatePoints = eligiblePoints(event); @@ -199,11 +199,11 @@ void QQuickMultiPointHandler::setPointDistanceThreshold(qreal pointDistanceThres emit pointDistanceThresholdChanged(); } -bool QQuickMultiPointHandler::sameAsCurrentPoints(QQuickPointerEvent *event) +bool QQuickMultiPointHandler::hasCurrentPoints(QQuickPointerEvent *event) { bool ret = true; int c = event->pointCount(); - if (c != m_currentPoints.size()) + if (c < m_currentPoints.size()) return false; // TODO optimize: either ensure the points are sorted, // or use std::equal with a predicate |