summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qgesture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qgesture.cpp')
-rw-r--r--src/gui/kernel/qgesture.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp
index 7b2cd6d..3639a45 100644
--- a/src/gui/kernel/qgesture.cpp
+++ b/src/gui/kernel/qgesture.cpp
@@ -335,22 +335,24 @@ QSwipeGesture::QSwipeGesture(QObject *parent)
QSwipeGesture::SwipeDirection QSwipeGesture::horizontalDirection() const
{
- return d_func()->horizontalDirection;
+ Q_D(const QSwipeGesture);
+ if (d->swipeAngle < 0 || d->swipeAngle == 90 || d->swipeAngle == 270)
+ return QSwipeGesture::NoDirection;
+ else if (d->swipeAngle < 90 || d->swipeAngle > 270)
+ return QSwipeGesture::Right;
+ else
+ return QSwipeGesture::Left;
}
QSwipeGesture::SwipeDirection QSwipeGesture::verticalDirection() const
{
- return d_func()->verticalDirection;
-}
-
-void QSwipeGesture::setHorizontalDirection(QSwipeGesture::SwipeDirection value)
-{
- d_func()->horizontalDirection = value;
-}
-
-void QSwipeGesture::setVerticalDirection(QSwipeGesture::SwipeDirection value)
-{
- d_func()->verticalDirection = value;
+ Q_D(const QSwipeGesture);
+ if (d->swipeAngle <= 0 || d->swipeAngle == 180)
+ return QSwipeGesture::NoDirection;
+ else if (d->swipeAngle < 180)
+ return QSwipeGesture::Up;
+ else
+ return QSwipeGesture::Down;
}
qreal QSwipeGesture::swipeAngle() const