aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2024-01-25 17:12:21 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2024-01-29 09:43:18 +0100
commitc61525f3aaa59f8de2e9b090c25ba739f097cec0 (patch)
tree0afec8655e2fdc8500ffa8f0d927742f33ca4ccd
parent9009675d468a53af8d6ffa60268915c50229cd8e (diff)
Drawer: respect content rotation also for touch events
Amends 79474b087a160f209dafc1e333063729d8ce03cb, which implemented this only for mouse event. Use the same logic for deciding which edge a touch event belongs to when the window's contentItem is rotated. Pick-to: 6.7 6.6 Task-number: QTBUG-80910 Task-number: QTBUG-71117 Task-number: QTBUG-115536 Fixes: QTBUG-121216 Change-Id: I0309e6a3f32b2e575b9cfa526041164732a81fd8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Jan Schwers <js@kempermusic.com>
-rw-r--r--src/quicktemplates/qquickdrawer.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/quicktemplates/qquickdrawer.cpp b/src/quicktemplates/qquickdrawer.cpp
index 9eb8f830ab..f67a8ec76a 100644
--- a/src/quicktemplates/qquickdrawer.cpp
+++ b/src/quicktemplates/qquickdrawer.cpp
@@ -391,10 +391,11 @@ bool QQuickDrawerPrivate::grabTouch(QQuickItem *item, QTouchEvent *event)
// QStyleHints::startDragDistance for dragging. Drawer uses a bit
// larger threshold to avoid being too eager to steal touch (QTBUG-50045)
const int threshold = qMax(20, QGuiApplication::styleHints()->startDragDistance() + 5);
+ const Qt::Edge effEdge = effectiveEdge();
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)
+ if (effEdge == Qt::LeftEdge || effEdge == Qt::RightEdge)
overThreshold = xOverThreshold && !yOverThreshold;
else
overThreshold = yOverThreshold && !xOverThreshold;
@@ -402,7 +403,7 @@ bool QQuickDrawerPrivate::grabTouch(QQuickItem *item, QTouchEvent *event)
// Don't be too eager to steal presses outside the drawer (QTBUG-53929)
if (overThreshold && qFuzzyCompare(position, qreal(1.0)) && !contains(movePoint)) {
- if (edge == Qt::LeftEdge || edge == Qt::RightEdge)
+ if (effEdge == Qt::LeftEdge || effEdge == Qt::RightEdge)
overThreshold = qAbs(movePoint.x() - q->width()) < dragMargin;
else
overThreshold = qAbs(movePoint.y() - q->height()) < dragMargin;