diff options
author | Liang Qi <liang.qi@qt.io> | 2018-10-01 11:59:36 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-10-01 11:59:36 +0200 |
commit | 87662fd1b71db11f0759e0be03d8a288ee11b775 (patch) | |
tree | 7e9659b6e581205c798844388cffcec88ecaa112 /src/quick/items/qquickwindow.cpp | |
parent | e8b01250fdbef269379df8c2481c9482317e8220 (diff) | |
parent | 777cd6e9b10c83f5826fde67ad00a85c978218c0 (diff) |
Merge remote-tracking branch 'origin/5.11' into 5.12
Conflicts:
src/quick/items/qquickevents_p_p.h
Change-Id: I8c699aeb46903e2ea80a97a346cb5af460859a98
Diffstat (limited to 'src/quick/items/qquickwindow.cpp')
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 804d82a212..8caa568a6c 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -697,8 +697,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)); @@ -2637,19 +2637,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); + } } } } |