From a181f32b35ae3fca6cee3f605500a20a4b27fe9c Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Fri, 26 Jun 2009 14:12:28 +0200 Subject: 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 --- src/gui/kernel/qdirectionrecognizer.cpp | 14 ++++++++------ 1 file 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(dx*dx + dy*dy)); - if (distance < SIZE/2) + if (distance < DistanceDelta/2) return Direction(); Qt::DirectionType direction = Qt::NoDirection; -- cgit v0.12