Use M_PI for 3.14

Change-Id: I19078a791afa1c74cd34e59b033525e029755d7e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2022-11-25 09:14:51 +01:00
parent 0a925009a1
commit dbdabf9c27
3 changed files with 4 additions and 6 deletions

View File

@@ -454,7 +454,7 @@ void ArrowItem::updateHeadGeometry(QGraphicsItem *headItem, const QPointF &pos,
QVector2D directionVector(pos - otherPos); QVector2D directionVector(pos - otherPos);
directionVector.normalize(); directionVector.normalize();
double angle = qAcos(directionVector.x()) * 180.0 / 3.1415926535; double angle = qAcos(directionVector.x()) * 180.0 / M_PI;
if (directionVector.y() > 0.0) if (directionVector.y() > 0.0)
angle = -angle; angle = -angle;
headItem->setRotation(-angle); headItem->setRotation(-angle);

View File

@@ -219,7 +219,7 @@ double GeometryUtilities::calcAngle(const QLineF &line)
{ {
QVector2D directionVector(line.p2() - line.p1()); QVector2D directionVector(line.p2() - line.p1());
directionVector.normalize(); directionVector.normalize();
double angle = qAcos(directionVector.x()) * 180.0 / 3.1415926535; double angle = qAcos(directionVector.x()) * 180.0 / M_PI;
if (directionVector.y() > 0.0) if (directionVector.y() > 0.0)
angle = -angle; angle = -angle;
return angle; return angle;

View File

@@ -8,7 +8,6 @@
#include "../actionmanager/actionmanager.h" #include "../actionmanager/actionmanager.h"
#include "../actionmanager/command.h" #include "../actionmanager/command.h"
#include "../icontext.h" #include "../icontext.h"
#include "../coreconstants.h"
#include "../icore.h" #include "../icore.h"
#include "../statusbarmanager.h" #include "../statusbarmanager.h"
@@ -28,10 +27,9 @@
#include <QStyle> #include <QStyle>
#include <QStyleOption> #include <QStyleOption>
#include <QTimer> #include <QTimer>
#include <QtMath>
#include <QVariant> #include <QVariant>
#include <math.h>
static const char kSettingsGroup[] = "Progress"; static const char kSettingsGroup[] = "Progress";
static const char kDetailsPinned[] = "DetailsPinned"; static const char kDetailsPinned[] = "DetailsPinned";
static const bool kDetailsPinnedDefault = true; static const bool kDetailsPinnedDefault = true;
@@ -787,7 +785,7 @@ void ProgressTimer::handleTimeout()
// future finishes. That's not bad for a random choice. // future finishes. That's not bad for a random choice.
const double mapped = atan2(double(m_currentTime) * TimerInterval / 1000.0, const double mapped = atan2(double(m_currentTime) * TimerInterval / 1000.0,
double(m_expectedTime)); double(m_expectedTime));
const double progress = 100 * 2 * mapped / 3.14; const double progress = 100 * 2 * mapped / M_PI;
m_futureInterface.setProgressValue(int(progress)); m_futureInterface.setProgressValue(int(progress));
} }