@@ -20,7 +20,7 | |||
|
20 | 20 | #include "stackedbarpresenter_p.h" |
|
21 | 21 | #include "percentbarpresenter_p.h" |
|
22 | 22 | #include "linechartitem_p.h" |
|
23 |
#include "pie |
|
|
23 | #include "piechartitem_p.h" | |
|
24 | 24 | #include "scatterchartitem_p.h" |
|
25 | 25 | #include "splinechartitem_p.h" |
|
26 | 26 | |
@@ -222,7 +222,7 void ChartPresenter::handleSeriesAdded(QSeries* series,Domain* domain) | |||
|
222 | 222 | |
|
223 | 223 | case QSeries::SeriesTypePie: { |
|
224 | 224 | QPieSeries *pieSeries = static_cast<QPieSeries *>(series); |
|
225 |
Pie |
|
|
225 | PieChartItem* pie = new PieChartItem(m_chart, pieSeries); | |
|
226 | 226 | if(m_options.testFlag(QChart::SeriesAnimations)) { |
|
227 | 227 | // m_animator->addAnimation(pie); |
|
228 | 228 | } |
@@ -24,7 +24,7 | |||
|
24 | 24 | #include "linechartitem_p.h" |
|
25 | 25 | #include "areachartitem_p.h" |
|
26 | 26 | #include "scatterchartitem_p.h" |
|
27 |
#include "pie |
|
|
27 | #include "piechartitem_p.h" | |
|
28 | 28 | #include "splinechartitem_p.h" |
|
29 | 29 | |
|
30 | 30 | //themes |
@@ -177,7 +177,7 void ChartTheme::decorate(QScatterSeries* series, int index) | |||
|
177 | 177 | } |
|
178 | 178 | } |
|
179 | 179 | |
|
180 |
void ChartTheme::decorate(Pie |
|
|
180 | void ChartTheme::decorate(PieChartItem* item, QPieSeries* series, int index) | |
|
181 | 181 | { |
|
182 | 182 | // Get color for a slice from a gradient linearly, beginning from the start of the gradient |
|
183 | 183 | for (int i(0); i < series->slices().count(); i++) { |
@@ -20,7 +20,7 class QPercentBarSeries; | |||
|
20 | 20 | class PercentBarPresenter; |
|
21 | 21 | class QScatterSeries; |
|
22 | 22 | class ScatterChartItem; |
|
23 |
class Pie |
|
|
23 | class PieChartItem; | |
|
24 | 24 | class QPieSeries; |
|
25 | 25 | class SplineChartItem; |
|
26 | 26 | class QSplineSeries; |
@@ -51,7 +51,7 public: | |||
|
51 | 51 | void decorate(QLineSeries* series, int index); |
|
52 | 52 | void decorate(QAreaSeries* series, int index); |
|
53 | 53 | void decorate(QScatterSeries* series, int index); |
|
54 |
void decorate(Pie |
|
|
54 | void decorate(PieChartItem* item, QPieSeries* series, int index); | |
|
55 | 55 | void decorate(QSplineSeries* series, int index); |
|
56 | 56 | void decorate(QChartAxis* axis, bool axisX); |
|
57 | 57 |
@@ -4,11 +4,11 DEPENDPATH += $$PWD | |||
|
4 | 4 | SOURCES += \ |
|
5 | 5 | $$PWD/qpieseries.cpp \ |
|
6 | 6 | $$PWD/pieslice.cpp \ |
|
7 |
$$PWD/pie |
|
|
7 | $$PWD/piechartitem.cpp \ | |
|
8 | 8 | $$PWD/qpieslice.cpp |
|
9 | 9 | |
|
10 | 10 | PRIVATE_HEADERS += \ |
|
11 |
$$PWD/pie |
|
|
11 | $$PWD/piechartitem_p.h \ | |
|
12 | 12 | $$PWD/pieslice_p.h \ |
|
13 | 13 | |
|
14 | 14 | PUBLIC_HEADERS += \ |
@@ -1,4 +1,4 | |||
|
1 |
#include "pie |
|
|
1 | #include "piechartitem_p.h" | |
|
2 | 2 | #include "pieslice_p.h" |
|
3 | 3 | #include "qpieslice.h" |
|
4 | 4 | #include "qpieseries.h" |
@@ -9,7 +9,7 | |||
|
9 | 9 | |
|
10 | 10 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
11 | 11 | |
|
12 |
Pie |
|
|
12 | PieChartItem::PieChartItem(QGraphicsItem *parent, QPieSeries *series) | |
|
13 | 13 | :ChartItem(parent), |
|
14 | 14 | m_series(series) |
|
15 | 15 | { |
@@ -20,12 +20,12 PiePresenter::PiePresenter(QGraphicsItem *parent, QPieSeries *series) | |||
|
20 | 20 | setZValue(ChartPresenter::PieSeriesZValue); |
|
21 | 21 | } |
|
22 | 22 | |
|
23 | PiePresenter::~PiePresenter() | |
|
23 | PieChartItem::~PieChartItem() | |
|
24 | 24 | { |
|
25 | 25 | // slices deleted automatically through QGraphicsItem |
|
26 | 26 | } |
|
27 | 27 | |
|
28 |
void Pie |
|
|
28 | void PieChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) | |
|
29 | 29 | { |
|
30 | 30 | // TODO: paint shadows for all components |
|
31 | 31 | // - get paths from items & merge & offset and draw with shadow color? |
@@ -33,14 +33,14 void PiePresenter::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QW | |||
|
33 | 33 | //painter->drawRect(m_debugRect); |
|
34 | 34 | } |
|
35 | 35 | |
|
36 |
void Pie |
|
|
36 | void PieChartItem::handleSeriesChanged() | |
|
37 | 37 | { |
|
38 | 38 | QVector<PieSliceLayout> sliceLayout = calculateLayout(); |
|
39 | 39 | applyLayout(sliceLayout); |
|
40 | 40 | update(); |
|
41 | 41 | } |
|
42 | 42 | |
|
43 |
void Pie |
|
|
43 | void PieChartItem::handleSliceChanged() | |
|
44 | 44 | { |
|
45 | 45 | // TODO: optimize don't need to handle all slices |
|
46 | 46 | QVector<PieSliceLayout> sliceLayout = calculateLayout(); |
@@ -48,12 +48,12 void PiePresenter::handleSliceChanged() | |||
|
48 | 48 | update(); |
|
49 | 49 | } |
|
50 | 50 | |
|
51 |
void Pie |
|
|
51 | void PieChartItem::handleDomainChanged(qreal, qreal, qreal, qreal) | |
|
52 | 52 | { |
|
53 | 53 | // TODO |
|
54 | 54 | } |
|
55 | 55 | |
|
56 |
void Pie |
|
|
56 | void PieChartItem::handleGeometryChanged(const QRectF& rect) | |
|
57 | 57 | { |
|
58 | 58 | prepareGeometryChange(); |
|
59 | 59 | m_rect = rect; |
@@ -63,7 +63,7 void PiePresenter::handleGeometryChanged(const QRectF& rect) | |||
|
63 | 63 | } |
|
64 | 64 | |
|
65 | 65 | |
|
66 |
QVector<PieSliceLayout> Pie |
|
|
66 | QVector<PieSliceLayout> PieChartItem::calculateLayout() | |
|
67 | 67 | { |
|
68 | 68 | // find pie center coordinates |
|
69 | 69 | QPointF center; |
@@ -92,7 +92,7 QVector<PieSliceLayout> PiePresenter::calculateLayout() | |||
|
92 | 92 | return layout; |
|
93 | 93 | } |
|
94 | 94 | |
|
95 |
void Pie |
|
|
95 | void PieChartItem::applyLayout(const QVector<PieSliceLayout> &layout) | |
|
96 | 96 | { |
|
97 | 97 | //if(m_animator) |
|
98 | 98 | // m_animator->applyLayout(this,points); |
@@ -100,7 +100,7 void PiePresenter::applyLayout(const QVector<PieSliceLayout> &layout) | |||
|
100 | 100 | setLayout(layout); |
|
101 | 101 | } |
|
102 | 102 | |
|
103 |
void Pie |
|
|
103 | void PieChartItem::setLayout(const QVector<PieSliceLayout> &layout) | |
|
104 | 104 | { |
|
105 | 105 | foreach (PieSliceLayout l, layout) { |
|
106 | 106 | |
@@ -138,6 +138,6 void PiePresenter::setLayout(const QVector<PieSliceLayout> &layout) | |||
|
138 | 138 | } |
|
139 | 139 | } |
|
140 | 140 | |
|
141 |
#include "moc_pie |
|
|
141 | #include "moc_piechartitem_p.cpp" | |
|
142 | 142 | |
|
143 | 143 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,5 +1,5 | |||
|
1 |
#ifndef PIE |
|
|
2 |
#define PIE |
|
|
1 | #ifndef PIECHARTITEM_H | |
|
2 | #define PIECHARTITEM_H | |
|
3 | 3 | |
|
4 | 4 | #include "qpieseries.h" |
|
5 | 5 | #include "chartitem_p.h" |
@@ -9,14 +9,14 class QGraphicsItem; | |||
|
9 | 9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
10 | 10 | class QPieSlice; |
|
11 | 11 | |
|
12 |
class Pie |
|
|
12 | class PieChartItem : public QObject, public ChartItem | |
|
13 | 13 | { |
|
14 | 14 | Q_OBJECT |
|
15 | 15 | |
|
16 | 16 | public: |
|
17 | 17 | // TODO: use a generic data class instead of x and y |
|
18 |
Pie |
|
|
19 |
~Pie |
|
|
18 | PieChartItem(QGraphicsItem *parent, QPieSeries *series); | |
|
19 | ~PieChartItem(); | |
|
20 | 20 | |
|
21 | 21 | public: // from QGraphicsItem |
|
22 | 22 | QRectF boundingRect() const { return m_rect; } |
@@ -45,4 +45,4 private: | |||
|
45 | 45 | |
|
46 | 46 | QTCOMMERCIALCHART_END_NAMESPACE |
|
47 | 47 | |
|
48 |
#endif // PIE |
|
|
48 | #endif // PIECHARTITEM_H |
@@ -1,5 +1,5 | |||
|
1 | 1 | #include "pieslice_p.h" |
|
2 |
#include "pie |
|
|
2 | #include "piechartitem_p.h" | |
|
3 | 3 | #include "qpieseries.h" |
|
4 | 4 | #include "qpieslice.h" |
|
5 | 5 | #include "chartpresenter_p.h" |
@@ -12,7 +12,7 | |||
|
12 | 12 | #define PIESLICE_LABEL_GAP 5 |
|
13 | 13 | |
|
14 | 14 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
15 |
class Pie |
|
|
15 | class PieChartItem; | |
|
16 | 16 | class PieSliceLabel; |
|
17 | 17 | class QPieSlice; |
|
18 | 18 |
@@ -11,7 +11,7 | |||
|
11 | 11 | |
|
12 | 12 | class QGraphicsObject; |
|
13 | 13 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
14 |
class Pie |
|
|
14 | class PieChartItem; | |
|
15 | 15 | class PieSlice; |
|
16 | 16 | class QPieSlice; |
|
17 | 17 | |
@@ -112,7 +112,7 private: | |||
|
112 | 112 | Q_DISABLE_COPY(QPieSeries) |
|
113 | 113 | |
|
114 | 114 | // TODO: use PIML |
|
115 |
friend class Pie |
|
|
115 | friend class PieChartItem; | |
|
116 | 116 | friend class PieSlice; |
|
117 | 117 | |
|
118 | 118 | QList<QPieSlice*> m_slices; |
General Comments 0
You need to be logged in to leave comments.
Login now