aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@theqtcompany.com>2016-04-19 09:35:33 +0200
committerMitch Curtis <mitch.curtis@theqtcompany.com>2016-04-19 10:41:41 +0000
commit30b2d62262e4ecfadf89dc0ee34644bebe5194fc (patch)
tree487006b5f2853353995f439dcc8147975f85f10b
parent60910fdd30a50f4e448206827c3f915c03c5a9f3 (diff)
Move angle calculation to static global variable.
This also: - gives names to what were pretty odd looking expressions - rewrites those expressions to be easier to understand Change-Id: Ia06d5702590d10cc53b9ae939a6877b6c403e091 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
-rw-r--r--src/quicktemplates2/qquickdial.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickdial.cpp b/src/quicktemplates2/qquickdial.cpp
index af02fd6f..7f73d399 100644
--- a/src/quicktemplates2/qquickdial.cpp
+++ b/src/quicktemplates2/qquickdial.cpp
@@ -75,7 +75,9 @@ QT_BEGIN_NAMESPACE
\sa {Customizing Dial}, {Input Controls}
*/
+static const qreal startAngleRadians = (M_PI * 2.0) * (4.0 / 6.0);
static const qreal startAngle = -140;
+static const qreal endAngleRadians = (M_PI * 2.0) * (5.0 / 6.0);
static const qreal endAngle = 140;
class QQuickDialPrivate : public QQuickControlPrivate
@@ -135,7 +137,7 @@ qreal QQuickDialPrivate::positionAt(const QPoint &point) const
if (angle < M_PI / -2)
angle = angle + M_PI * 2;
- qreal normalizedAngle = (M_PI * 4 / 3 - angle) / (M_PI * 10 / 6);
+ qreal normalizedAngle = (startAngleRadians - angle) / endAngleRadians;
return normalizedAngle;
}