summaryrefslogtreecommitdiffstats
path: root/examples/widgets/graphicsview/diagramscene/arrow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/graphicsview/diagramscene/arrow.cpp')
-rw-r--r--examples/widgets/graphicsview/diagramscene/arrow.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/examples/widgets/graphicsview/diagramscene/arrow.cpp b/examples/widgets/graphicsview/diagramscene/arrow.cpp
index 012b9ea2ed..ae7fa7af90 100644
--- a/examples/widgets/graphicsview/diagramscene/arrow.cpp
+++ b/examples/widgets/graphicsview/diagramscene/arrow.cpp
@@ -51,7 +51,7 @@
#include "arrow.h"
-#include <math.h>
+#include <cmath>
#include <QPen>
#include <QPainter>
@@ -132,9 +132,7 @@ void Arrow::paint(QPainter *painter, const QStyleOptionGraphicsItem *,
setLine(QLineF(intersectPoint, myStartItem->pos()));
//! [5] //! [6]
- double angle = ::acos(line().dx() / line().length());
- if (line().dy() >= 0)
- angle = (Pi * 2) - angle;
+ double angle = std::atan2(-line().dy(), line().dx());
QPointF arrowP1 = line().p1() + QPointF(sin(angle + Pi / 3) * arrowSize,
cos(angle + Pi / 3) * arrowSize);