summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qdirectionrecognizer.cpp
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-03-16 13:56:24 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-05-11 14:51:34 (GMT)
commitd392c3073c10d053ffcd5d64d4f9d89a971fcb2d (patch)
treeb0bc9f3b46a3b76051d45b72e984c177f17bb66d /src/gui/kernel/qdirectionrecognizer.cpp
parentd8e4d20f3d225a3c29168d7a9440f2efc129ea8e (diff)
downloadQt-d392c3073c10d053ffcd5d64d4f9d89a971fcb2d.zip
Qt-d392c3073c10d053ffcd5d64d4f9d89a971fcb2d.tar.gz
Qt-d392c3073c10d053ffcd5d64d4f9d89a971fcb2d.tar.bz2
Extended the gesture documentation.
Also made some small fixes that noticed while was writing a doc.
Diffstat (limited to 'src/gui/kernel/qdirectionrecognizer.cpp')
-rw-r--r--src/gui/kernel/qdirectionrecognizer.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/gui/kernel/qdirectionrecognizer.cpp b/src/gui/kernel/qdirectionrecognizer.cpp
index 37b64e7..2896523 100644
--- a/src/gui/kernel/qdirectionrecognizer.cpp
+++ b/src/gui/kernel/qdirectionrecognizer.cpp
@@ -64,22 +64,22 @@ Direction QDirectionSimpleRecognizer::addPosition(const QPoint &pos)
}
int dx = pos.x() - lastPoint.x();
int dy = pos.y() - lastPoint.y();
- Direction::DirectionType direction = Direction::None;
+ Qt::DirectionType direction = Qt::NoDirection;
if (dx < 0) {
if (-1*dx >= SIZE/2)
- direction = Direction::Left;
+ direction = Qt::LeftDirection;
} else {
if (dx >= SIZE/2)
- direction = Direction::Right;
+ direction = Qt::RightDirection;
}
if (dy < 0) {
if (-1*dy >= SIZE/2)
- direction = Direction::Up;
+ direction = Qt::UpDirection;
} else {
if (dy >= SIZE/2)
- direction = Direction::Down;
+ direction = Qt::DownDirection;
}
- if (direction == Direction::None)
+ if (direction == Qt::NoDirection)
return Direction();
lastPoint = pos;
@@ -123,7 +123,7 @@ Direction QDirectionDiagonalRecognizer::addPosition(const QPoint &pos)
if (distance < SIZE/2)
return Direction();
- Direction::DirectionType direction = Direction::None;
+ Qt::DirectionType direction = Qt::NoDirection;
double angle = atan(1.0*qAbs(lastPoint.y() - pos.y())/qAbs(pos.x() - lastPoint.x())) * 180. / M_PI;
if (dx < 0 && dy <= 0) {
angle = 180 - angle;
@@ -135,25 +135,25 @@ Direction QDirectionDiagonalRecognizer::addPosition(const QPoint &pos)
if (angle < 0)
angle += 360;
if (angle <= 20)
- direction = Direction::Right;
+ direction = Qt::RightDirection;
else if (angle <= 65)
- direction = Direction::RightUp;
+ direction = Qt::RightUpDirection;
else if (angle <= 110)
- direction = Direction::Up;
+ direction = Qt::UpDirection;
else if (angle <= 155)
- direction = Direction::LeftUp;
+ direction = Qt::LeftUpDirection;
else if (angle <= 200)
- direction = Direction::Left;
+ direction = Qt::LeftDirection;
else if (angle <= 245)
- direction = Direction::LeftDown;
+ direction = Qt::LeftDownDirection;
else if (angle <= 290)
- direction = Direction::Down;
+ direction = Qt::DownDirection;
else if (angle <= 335)
- direction = Direction::RightDown;
+ direction = Qt::RightDownDirection;
else
- direction = Direction::Right;
+ direction = Qt::RightDirection;
- if (direction == Direction::None)
+ if (direction == Qt::NoDirection)
return Direction();
lastPoint = pos;