aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2017-08-16 09:39:06 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2017-09-12 09:49:35 +0000
commit7f61147d534757daf24bc2459eac49864985dd8b (patch)
treebba9e4d5f8f790957e6c03454fa97423a50996a6
parenta1b42f95a711f8d8fb87d79ad04eee0a433749ed (diff)
QQuickMultiPointHandler::eligiblePoints: use parent not target
If a PinchHandler for example is declared with target: null, it was crashing here. The eligible points are contained within the Item within which the Handler is declared; it's OK to do a pinch gesture within one Item but manipulate another Item instead. In such a case, the parent and target are different. Alternatively, target can be set to null, if the user is only interested in reacting to the Handler's properties in some other way rather than directly manipulating some target. Change-Id: Ia077006be1285c242fe7ba71ea89850cd7717c7c Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
-rw-r--r--src/quick/handlers/qquickmultipointhandler.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/quick/handlers/qquickmultipointhandler.cpp b/src/quick/handlers/qquickmultipointhandler.cpp
index 6cc7747e3a..41d8b228a1 100644
--- a/src/quick/handlers/qquickmultipointhandler.cpp
+++ b/src/quick/handlers/qquickmultipointhandler.cpp
@@ -80,7 +80,7 @@ QVector<QQuickEventPoint *> QQuickMultiPointHandler::eligiblePoints(QQuickPointe
{
QVector<QQuickEventPoint *> ret;
int c = event->pointCount();
- QRectF targetBounds = target()->mapRectToScene(target()->boundingRect())
+ QRectF parentBounds = parentItem()->mapRectToScene(parentItem()->boundingRect())
.marginsAdded(QMarginsF(m_pointDistanceThreshold, m_pointDistanceThreshold, m_pointDistanceThreshold, m_pointDistanceThreshold));
// If one or more points are newly pressed or released, all non-released points are candidates for this handler.
// In other cases however, do not steal the grab: that is, if a point has a grabber,
@@ -93,7 +93,7 @@ QVector<QQuickEventPoint *> QQuickMultiPointHandler::eligiblePoints(QQuickPointe
if (exclusiveGrabber && exclusiveGrabber != this)
continue;
}
- if (p->state() != QQuickEventPoint::Released && targetBounds.contains(p->scenePosition()))
+ if (p->state() != QQuickEventPoint::Released && parentBounds.contains(p->scenePosition()))
ret << p;
}
return ret;