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