path: root/src/gui/text/qdistancefield.cpp
diff options
authorEdward Welbourne <>2017-02-21 17:14:37 +0100
committerGiuseppe D'Angelo <>2017-07-05 10:15:34 +0000
commit8095c33bcddefebd16b7cb08b07690caf877f600 (patch)
tree816731835b77eb798295c4324f95b23f9916ebef /src/gui/text/qdistancefield.cpp
parent827e53540c8de10f3a0b8548523ca80bf9e1c75b (diff)
Use qRadiansToDegrees() and qDegreesToRadians() more widely
Especially in examples, where we should show off our convenience functions, prefer calling these functions over doing arithmetic with M_PI (or approximations thereto) and 180 (give or take simple factors). This incidentally documents what's going on, just by the name of the function used (and reveals at least one place where variables were misnamed; the return from atan is in radians, *not* degrees). Task-number: QTBUG-58083 Change-Id: I6e5d66721cafab423378f970af525400423e971e Reviewed-by: Jüri Valdmann <> Reviewed-by: Allan Sandfeld Jensen <> Reviewed-by: Marc Mutz <>
Diffstat (limited to 'src/gui/text/qdistancefield.cpp')
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp
index 746200fd9c..af13b96c32 100644
--- a/src/gui/text/qdistancefield.cpp
+++ b/src/gui/text/qdistancefield.cpp
@@ -516,7 +516,7 @@ static void makeDistanceField(QDistanceFieldData *data, const QPainterPath &path
for (int i = 0; i < imgWidth * imgHeight; ++i)
bits[i] = exteriorColor;
- const qreal angleStep = qreal(15 * 3.141592653589793238 / 180);
+ const qreal angleStep = qDegreesToRadians(qreal(15));
const QPoint rotation(qRound(qCos(angleStep) * 0x4000),
qRound(qSin(angleStep) * 0x4000)); // 2:14 signed