diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-26 12:12:28 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-26 12:12:28 (GMT) |
commit | a181f32b35ae3fca6cee3f605500a20a4b27fe9c (patch) | |
tree | d3f0efd48d322ba3013d99dffad9d58bc27810f0 /src/gui/kernel | |
parent | a5188742e4666f5181f85745677abfbf9e658076 (diff) | |
download | Qt-a181f32b35ae3fca6cee3f605500a20a4b27fe9c.zip Qt-a181f32b35ae3fca6cee3f605500a20a4b27fe9c.tar.gz Qt-a181f32b35ae3fca6cee3f605500a20a4b27fe9c.tar.bz2 |
Compile on WinCE
Replace the SIZE constant with an Enum with a Qt-ish CamelCased name
(since SIZE conflicts with the system headers).
Reviewed-by: TrustMe
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qdirectionrecognizer.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gui/kernel/qdirectionrecognizer.cpp b/src/gui/kernel/qdirectionrecognizer.cpp index 2896523..7072080 100644 --- a/src/gui/kernel/qdirectionrecognizer.cpp +++ b/src/gui/kernel/qdirectionrecognizer.cpp @@ -45,7 +45,9 @@ QT_BEGIN_NAMESPACE -static const int SIZE = 20; +enum { + DistanceDelta = 20 +}; QDirectionSimpleRecognizer::QDirectionSimpleRecognizer() { @@ -66,17 +68,17 @@ Direction QDirectionSimpleRecognizer::addPosition(const QPoint &pos) int dy = pos.y() - lastPoint.y(); Qt::DirectionType direction = Qt::NoDirection; if (dx < 0) { - if (-1*dx >= SIZE/2) + if (-1*dx >= DistanceDelta/2) direction = Qt::LeftDirection; } else { - if (dx >= SIZE/2) + if (dx >= DistanceDelta/2) direction = Qt::RightDirection; } if (dy < 0) { - if (-1*dy >= SIZE/2) + if (-1*dy >= DistanceDelta/2) direction = Qt::UpDirection; } else { - if (dy >= SIZE/2) + if (dy >= DistanceDelta/2) direction = Qt::DownDirection; } if (direction == Qt::NoDirection) @@ -120,7 +122,7 @@ Direction QDirectionDiagonalRecognizer::addPosition(const QPoint &pos) int dx = pos.x() - lastPoint.x(); int dy = pos.y() - lastPoint.y(); int distance = sqrt(static_cast<double>(dx*dx + dy*dy)); - if (distance < SIZE/2) + if (distance < DistanceDelta/2) return Direction(); Qt::DirectionType direction = Qt::NoDirection; |