diff options
Diffstat (limited to 'stats/pieseries.h')
| -rw-r--r-- | stats/pieseries.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/stats/pieseries.h b/stats/pieseries.h index 646c4bfbe..0cb5e12cb 100644 --- a/stats/pieseries.h +++ b/stats/pieseries.h @@ -3,6 +3,7 @@ #ifndef PIE_SERIES_H #define PIE_SERIES_H +#include "statshelper.h" #include "statsseries.h" #include <memory> @@ -10,9 +11,8 @@ #include <QString> struct InformationBox; -class QGraphicsEllipseItem; -class QGraphicsScene; -class QGraphicsSimpleTextItem; +struct ChartPieItem; +struct ChartTextItem; class QRectF; class PieSeries : public StatsSeries { @@ -20,8 +20,8 @@ public: // The pie series is initialized with (name, count) pairs. // If keepOrder is false, bins will be sorted by size, otherwise the sorting // of the shown bins will be retained. Small bins are omitted for clarity. - PieSeries(QGraphicsScene *scene, StatsAxis *xAxis, StatsAxis *yAxis, const QString &categoryName, - const std::vector<std::pair<QString, int>> &data, bool keepOrder, bool labels); + PieSeries(StatsView &view, StatsAxis *xAxis, StatsAxis *yAxis, const QString &categoryName, + const std::vector<std::pair<QString, int>> &data, bool keepOrder); ~PieSeries(); void updatePositions() override; @@ -34,20 +34,20 @@ private: // Get item under mouse pointer, or -1 if none int getItemUnderMouse(const QPointF &f) const; + ChartItemPtr<ChartPieItem> item; QString categoryName; std::vector<QString> makeInfo(int idx) const; struct Item { - std::unique_ptr<QGraphicsEllipseItem> item; - std::unique_ptr<QGraphicsSimpleTextItem> innerLabel, outerLabel; + ChartItemPtr<ChartTextItem> innerLabel, outerLabel; QString name; - double angleTo; // In fraction of total + double angleFrom, angleTo; // In fraction of total int count; QPointF innerLabelPos, outerLabelPos; // With respect to a (-1, -1)-(1, 1) rectangle. - Item(QGraphicsScene *scene, const QString &name, int from, int count, int totalCount, - int bin_nr, int numBins, bool labels); - void updatePositions(const QRectF &rect, const QPointF ¢er, double radius); - void highlight(int bin_nr, bool highlight, int numBins); + Item(StatsView &view, const QString &name, int from, int count, int totalCount, + int bin_nr, int numBins); + void updatePositions(const QPointF ¢er, double radius); + void highlight(ChartPieItem &item, int bin_nr, bool highlight, int numBins); }; std::vector<Item> items; int totalCount; @@ -59,7 +59,7 @@ private: }; std::vector<OtherItem> other; - std::unique_ptr<InformationBox> information; + ChartItemPtr<InformationBox> information; QPointF center; // center of drawing area double radius; // radius of pie int highlighted; |