aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickdrawer.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2018-03-08 16:32:59 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2018-03-09 09:08:42 +0000
commit031a1e89e1baa952225c0f036b605f591f554e9b (patch)
tree1eba28f4fa525482223a021d6b1ba7885a7d9a22 /src/quicktemplates2/qquickdrawer.cpp
parent0dbfa219e704dbccadff9f305817bfd4ef37905b (diff)
QQuickDrawer: fix draggingv5.11.0-beta2
Make sure to respect keepMouse|TouchGrab. This fixes dragging a horizontal Slider inside a Drawer on the left or right edge, for example. Task-number: QTBUG-66637 Change-Id: Ie3688744741378694f96abc608dad2630ecd1fb0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickdrawer.cpp')
-rw-r--r--src/quicktemplates2/qquickdrawer.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp
index 202d02d1..2d60e649 100644
--- a/src/quicktemplates2/qquickdrawer.cpp
+++ b/src/quicktemplates2/qquickdrawer.cpp
@@ -319,12 +319,17 @@ bool QQuickDrawerPrivate::startDrag(QEvent *event)
return false;
}
+static inline bool keepGrab(QQuickItem *item)
+{
+ return item->keepMouseGrab() || item->keepTouchGrab();
+}
+
bool QQuickDrawerPrivate::grabMouse(QQuickItem *item, QMouseEvent *event)
{
Q_Q(QQuickDrawer);
handleMouseEvent(item, event);
- if (!window || !interactive || popupItem->keepMouseGrab() || popupItem->keepTouchGrab())
+ if (!window || !interactive || keepGrab(popupItem) || keepGrab(item))
return false;
const QPointF movePoint = event->windowPos();
@@ -352,12 +357,9 @@ bool QQuickDrawerPrivate::grabMouse(QQuickItem *item, QMouseEvent *event)
}
if (overThreshold) {
- QQuickItem *grabber = window->mouseGrabberItem();
- if (!grabber || !grabber->keepMouseGrab()) {
- popupItem->grabMouse();
- popupItem->setKeepMouseGrab(true);
- offset = offsetAt(movePoint);
- }
+ popupItem->grabMouse();
+ popupItem->setKeepMouseGrab(true);
+ offset = offsetAt(movePoint);
}
return overThreshold;
@@ -369,7 +371,7 @@ bool QQuickDrawerPrivate::grabTouch(QQuickItem *item, QTouchEvent *event)
Q_Q(QQuickDrawer);
bool handled = handleTouchEvent(item, event);
- if (!window || !interactive || popupItem->keepTouchGrab() || !event->touchPointStates().testFlag(Qt::TouchPointMoved))
+ if (!window || !interactive || keepGrab(popupItem) || keepGrab(item) || !event->touchPointStates().testFlag(Qt::TouchPointMoved))
return handled;
bool overThreshold = false;