path: root/tests/benchmarks
diff options
authorEdward Welbourne <>2017-02-21 17:14:37 +0100
committerGiuseppe D'Angelo <>2017-07-05 10:15:34 +0000
commit8095c33bcddefebd16b7cb08b07690caf877f600 (patch)
tree816731835b77eb798295c4324f95b23f9916ebef /tests/benchmarks
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 'tests/benchmarks')
1 files changed, 2 insertions, 5 deletions
diff --git a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp
index ea08af7608..f2e6973e27 100644
--- a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp
@@ -33,10 +33,7 @@
#include <QImage>
#include <QPaintEngine>
#include <QTileRules>
-#include <math.h>
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
+#include <qmath.h>
#include <private/qpixmap_raster_p.h>
@@ -1232,7 +1229,7 @@ QTransform tst_QPainter::transformForAngle(qreal angle)
QTransform rotTrans2;
rotTrans2.translate(40, 0);
- qreal rad = angle * 2. * M_PI / 360.;
+ qreal rad = qDegreesToRadians(angle);
qreal c = ::cos(rad);
qreal s = ::sin(rad);