aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickdrawer.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-05-02 13:44:17 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-05-02 20:50:51 +0000
commit4ab5b4de70a91e26c1736fa5757a4124b15bab3c (patch)
tree1d0985dbf0b6fc3986318af35600e0697a96d93e /src/quicktemplates2/qquickdrawer.cpp
parentfe86b0fda7bcce099a0bca08e6925e89efc634c4 (diff)
Drawer: fix drag-over-threshold calculation
Don't steal a horizontal drag if a flickable has been dragged a long distance vertically, and then later the flick happens to exceed the horizontal drag threshold. Change-Id: Idf39997aa20cc41da561f182119199f30c63ba32 Task-number: QTBUG-60521 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickdrawer.cpp')
-rw-r--r--src/quicktemplates2/qquickdrawer.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp
index 5fdc8be4..2ca0f6c3 100644
--- a/src/quicktemplates2/qquickdrawer.cpp
+++ b/src/quicktemplates2/qquickdrawer.cpp
@@ -301,10 +301,12 @@ bool QQuickDrawerPrivate::grabMouse(QQuickItem *item, QMouseEvent *event)
const int threshold = qMax(20, QGuiApplication::styleHints()->startDragDistance() + 5);
bool overThreshold = false;
if (position > 0 || dragMargin > 0) {
+ const bool xOverThreshold = QQuickWindowPrivate::dragOverThreshold(movePoint.x() - pressPoint.x(), Qt::XAxis, event, threshold);
+ const bool yOverThreshold = QQuickWindowPrivate::dragOverThreshold(movePoint.y() - pressPoint.y(), Qt::YAxis, event, threshold);
if (edge == Qt::LeftEdge || edge == Qt::RightEdge)
- overThreshold = QQuickWindowPrivate::dragOverThreshold(movePoint.x() - pressPoint.x(), Qt::XAxis, event, threshold);
+ overThreshold = xOverThreshold && !yOverThreshold;
else
- overThreshold = QQuickWindowPrivate::dragOverThreshold(movePoint.y() - pressPoint.y(), Qt::YAxis, event, threshold);
+ overThreshold = yOverThreshold && !xOverThreshold;
}
// Don't be too eager to steal presses outside the drawer (QTBUG-53929)
@@ -351,10 +353,12 @@ bool QQuickDrawerPrivate::grabTouch(QQuickItem *item, QTouchEvent *event)
// larger threshold to avoid being too eager to steal touch (QTBUG-50045)
const int threshold = qMax(20, QGuiApplication::styleHints()->startDragDistance() + 5);
if (position > 0 || dragMargin > 0) {
+ const bool xOverThreshold = QQuickWindowPrivate::dragOverThreshold(movePoint.x() - pressPoint.x(), Qt::XAxis, &point, threshold);
+ const bool yOverThreshold = QQuickWindowPrivate::dragOverThreshold(movePoint.y() - pressPoint.y(), Qt::YAxis, &point, threshold);
if (edge == Qt::LeftEdge || edge == Qt::RightEdge)
- overThreshold = QQuickWindowPrivate::dragOverThreshold(movePoint.x() - pressPoint.x(), Qt::XAxis, &point, threshold);
+ overThreshold = xOverThreshold && !yOverThreshold;
else
- overThreshold = QQuickWindowPrivate::dragOverThreshold(movePoint.y() - pressPoint.y(), Qt::YAxis, &point, threshold);
+ overThreshold = yOverThreshold && !xOverThreshold;
}
// Don't be too eager to steal presses outside the drawer (QTBUG-53929)