summaryrefslogtreecommitdiffstats
path: root/tests/manual/wavechart/wavechart.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/wavechart/wavechart.cpp')
-rw-r--r--tests/manual/wavechart/wavechart.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/manual/wavechart/wavechart.cpp b/tests/manual/wavechart/wavechart.cpp
index d2995826..72e5e737 100644
--- a/tests/manual/wavechart/wavechart.cpp
+++ b/tests/manual/wavechart/wavechart.cpp
@@ -28,18 +28,17 @@
****************************************************************************/
#include "wavechart.h"
-#include <cmath>
+#include <qmath.h>
QT_CHARTS_USE_NAMESPACE
-#define PI 3.14159265358979
static const int numPoints =100;
WaveChart::WaveChart(QChart* chart, QWidget* parent) :
QChartView(chart, parent),
m_series(new QLineSeries()),
m_wave(0),
- m_step(2 * PI / numPoints)
+ m_step(2 * M_PI / numPoints)
{
QPen blue(Qt::blue);
blue.setWidth(3);
@@ -52,7 +51,7 @@ WaveChart::WaveChart(QChart* chart, QWidget* parent) :
int fluctuate = 100;
- for (qreal x = 0; x <= 2 * PI; x += m_step) {
+ for (qreal x = 0; x <= 2 * M_PI; x += m_step) {
m_series->append(x, fabs(sin(x) * fluctuate));
}
@@ -69,7 +68,7 @@ void WaveChart::update()
int fluctuate;
const QList<QPointF>& points = m_series->points();
- for (qreal i = 0, x = 0; x <= 2 * PI; x += m_step, i++) {
+ for (qreal i = 0, x = 0; x <= 2 * M_PI; x += m_step, i++) {
fluctuate = qrand() % 100;
m_series->replace(x,points[i].y(),x,fabs(sin(x) * fluctuate));