From 4ae2df97db4bf2e07b7c3b9f03957eb62a36e969 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 3 Sep 2014 09:40:01 +0200 Subject: QSwipeGestureRecognizer: Use qAbs() to check distances. Task-number: QTBUG-15768 Change-Id: Idc6c6687430365a015fb2c15f4e4dcae6a687f9f Reviewed-by: Shawn Rutledge (cherry picked from qtbase/74303ad497ff0e3a9876d349e2ce2f67f08c0fbf) --- src/gui/kernel/qstandardgestures.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index de4188c..e80138b 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -348,7 +348,7 @@ QGestureRecognizer::Result QSwipeGestureRecognizer::recognize(QGesture *state, d->swipeAngle = QLineF(p1.startScreenPos(), p1.screenPos()).angle(); static const int MoveThreshold = 50; - if (xDistance > MoveThreshold || yDistance > MoveThreshold) { + if (qAbs(xDistance) > MoveThreshold || qAbs(yDistance) > MoveThreshold) { // measure the distance to check if the direction changed d->lastPositions[0] = p1.screenPos().toPoint(); d->lastPositions[1] = p2.screenPos().toPoint(); -- cgit v0.12