summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-09-11 15:38:42 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-09-11 15:38:42 +0200
commitc2494382432d66cc08c14877378354f1b6cd6bfd (patch)
tree96f3249cad2580b37d6852757c4804dbccc07ea6
parente48a10d40001c6efdb3b875c1d0087674dee2a48 (diff)
parent0431e462dff57bc6a9010649c0d7f153d91cab2d (diff)
Merge remote-tracking branch 'origin/5.11.2' into 5.11
-rw-r--r--src/quick/items/qquickevents_p_p.h2
-rw-r--r--src/quick/items/qquickwindow.cpp21
2 files changed, 13 insertions, 10 deletions
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index 3f70ad8c2d..4097845ec9 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -429,7 +429,7 @@ public: // helpers for C++ only (during event delivery)
virtual bool allUpdatedPointsAccepted() const = 0;
virtual bool allPointsGrabbed() const = 0;
bool isAccepted() { return m_event->isAccepted(); }
- void setAccepted(bool accepted) { m_event->setAccepted(accepted); }
+ void setAccepted(bool accepted) { if (m_event) m_event->setAccepted(accepted); }
QVector<QPointF> unacceptedPressedPointScenePositions() const;
virtual int pointCount() const = 0;
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index d9db8b56b4..5cd04decf7 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -690,8 +690,8 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve
touchMouseId = p.id();
if (!q->mouseGrabberItem())
item->grabMouse();
- auto pointerEventPoint = pointerEvent->pointById(p.id());
- pointerEventPoint->setGrabberItem(item);
+ if (auto pointerEventPoint = pointerEvent->pointById(p.id()))
+ pointerEventPoint->setGrabberItem(item);
if (checkIfDoubleClicked(event->timestamp())) {
QScopedPointer<QMouseEvent> mouseDoubleClick(touchToMouseEvent(QEvent::MouseButtonDblClick, p, event.data(), item, false));
@@ -2607,19 +2607,22 @@ void QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, QQuickPo
// update accepted new points.
bool isPressOrRelease = pointerEvent->isPressEvent() || pointerEvent->isReleaseEvent();
for (auto point: qAsConst(touchEvent->touchPoints())) {
- auto pointerEventPoint = ptEvent->pointById(point.id());
- pointerEventPoint->setAccepted();
- if (isPressOrRelease)
- pointerEventPoint->setGrabberItem(item);
+ if (auto pointerEventPoint = ptEvent->pointById(point.id())) {
+ pointerEventPoint->setAccepted();
+ if (isPressOrRelease)
+ pointerEventPoint->setGrabberItem(item);
+ }
}
} else {
// But if the event was not accepted then we know this item
// will not be interested in further updates for those touchpoint IDs either.
for (auto point: qAsConst(touchEvent->touchPoints())) {
if (point.state() == Qt::TouchPointPressed) {
- if (ptEvent->pointById(point.id())->exclusiveGrabber() == item) {
- qCDebug(DBG_TOUCH_TARGET) << "TP" << hex << point.id() << "disassociated";
- ptEvent->pointById(point.id())->setGrabberItem(nullptr);
+ if (auto *tp = ptEvent->pointById(point.id())) {
+ if (tp->exclusiveGrabber() == item) {
+ qCDebug(DBG_TOUCH_TARGET) << "TP" << hex << point.id() << "disassociated";
+ tp->setGrabberItem(nullptr);
+ }
}
}
}