From 8095c33bcddefebd16b7cb08b07690caf877f600 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 21 Feb 2017 17:14:37 +0100 Subject: Use qRadiansToDegrees() and qDegreesToRadians() more widely MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/plugins/generic/tuiotouch/qtuiohandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/generic/tuiotouch/qtuiohandler.cpp') diff --git a/src/plugins/generic/tuiotouch/qtuiohandler.cpp b/src/plugins/generic/tuiotouch/qtuiohandler.cpp index ac410b7415..bb18ba5085 100644 --- a/src/plugins/generic/tuiotouch/qtuiohandler.cpp +++ b/src/plugins/generic/tuiotouch/qtuiohandler.cpp @@ -523,7 +523,7 @@ QWindowSystemInterface::TouchPoint QTuioHandler::tokenToTouchPoint(const QTuioTo QPointF delta = relPos - relPos.toPoint(); tp.area.moveCenter(win->mapToGlobal(relPos.toPoint()) + delta); tp.velocity = QVector2D(win->size().width() * tc.vx(), win->size().height() * tc.vy()); - tp.rotation = tc.angle() * 180.0 / M_PI; // convert radians to degrees + tp.rotation = qRadiansToDegrees(tc.angle()); return tp; } -- cgit v1.2.3