diff options
Diffstat (limited to 'stats/statsgrid.cpp')
-rw-r--r-- | stats/statsgrid.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/stats/statsgrid.cpp b/stats/statsgrid.cpp index fe99b1762..11b05882b 100644 --- a/stats/statsgrid.cpp +++ b/stats/statsgrid.cpp @@ -2,6 +2,7 @@ #include "statsgrid.h" #include "statsaxis.h" #include "statscolors.h" +#include "statshelper.h" #include "zvalues.h" #include <QChart> @@ -10,8 +11,8 @@ static const double gridWidth = 1.0; static const Qt::PenStyle gridStyle = Qt::SolidLine; -StatsGrid::StatsGrid(QtCharts::QChart *chart, const StatsAxis &xAxis, const StatsAxis &yAxis) - : chart(chart), xAxis(xAxis), yAxis(yAxis) +StatsGrid::StatsGrid(QGraphicsScene *scene, const StatsAxis &xAxis, const StatsAxis &yAxis) + : scene(scene), xAxis(xAxis), yAxis(yAxis) { } @@ -24,12 +25,12 @@ void StatsGrid::updatePositions() return; for (double x: xtics) { - lines.emplace_back(new QGraphicsLineItem(x, ytics.front(), x, ytics.back(), chart)); + lines.emplace_back(createItem<QGraphicsLineItem>(scene, x, ytics.front(), x, ytics.back())); lines.back()->setPen(QPen(gridColor, gridWidth, gridStyle)); lines.back()->setZValue(ZValues::grid); } for (double y: ytics) { - lines.emplace_back(new QGraphicsLineItem(xtics.front(), y, xtics.back(), y, chart)); + lines.emplace_back(createItem<QGraphicsLineItem>(scene, xtics.front(), y, xtics.back(), y)); lines.back()->setPen(QPen(gridColor, gridWidth, gridStyle)); lines.back()->setZValue(ZValues::grid); } |