blob: d8e83e574182512ad85555e9b19633f822e925d1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#ifndef PIE_LEGEND_H
#define PIE_LEGEND_H
#include <QtWidgets>
#include "DataPoint.h"
class PieChartScene;
class PieLegend: public QGraphicsItem
{
public:
static const int Width = 150;
static const int SquareSide = 20;
static const int LabelSpacing = 10;
static const int LabelTextSpacing = 10;
public:
PieLegend(const QPointF& pos, const PieChartScene* scene);
QRectF boundingRect() const;
void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget* = 0) {}
private:
void addLabels();
QPointF getLabelPos(int index) const;
void addLabel(int index, const QPointF& pos);
QPointF getTextPos(const QPointF& squarePos,
const QGraphicsSimpleTextItem* textItem) const;
private:
const PieChartScene* scene;
};
#endif
|