aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-10-01 12:39:45 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2018-10-01 12:39:45 +0000
commit1dce83ba31e0e480b8eae43c1fc59c6cd5bb4d5c (patch)
tree81c96fe47896b4a238a97fcba3bb973b50156a6d /src/quick
parent91bde278ea2e883b4a46cafb1afc1781c71c1590 (diff)
parent87662fd1b71db11f0759e0be03d8a288ee11b775 (diff)
Merge "Merge remote-tracking branch 'origin/5.11' into 5.12" into refs/staging/5.12
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/items/qquickpathview.cpp2
-rw-r--r--src/quick/items/qquickwindow.cpp21
2 files changed, 14 insertions, 9 deletions
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index 879db6284e..e7e19b041e 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -1632,6 +1632,7 @@ void QQuickPathView::mousePressEvent(QMouseEvent *event)
void QQuickPathViewPrivate::handleMousePressEvent(QMouseEvent *event)
{
+ Q_Q(QQuickPathView);
if (!interactive || !items.count() || !model || !modelCount)
return;
velocityBuffer.clear();
@@ -1657,6 +1658,7 @@ void QQuickPathViewPrivate::handleMousePressEvent(QMouseEvent *event)
stealMouse = true; // If we've been flicked then steal the click.
else
stealMouse = false;
+ q->setKeepMouseGrab(stealMouse);
timer.start();
lastPosTime = computeCurrentTime(event);
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);
+ }
}
}
}