@@ -82,7 +82,7 void XYAnimation::updateCurrentValue (const QVariant & value ) | |||
|
82 | 82 | { |
|
83 | 83 | if(state()!=QAbstractAnimation::Stopped){ //workaround |
|
84 | 84 | QVector<QPointF> vector = qVariantValue<QVector<QPointF> >(value); |
|
85 |
m_item->set |
|
|
85 | m_item->setLayout(vector); | |
|
86 | 86 | } |
|
87 | 87 | } |
|
88 | 88 |
@@ -40,16 +40,6 QPainterPath AreaChartItem::shape() const | |||
|
40 | 40 | return m_path; |
|
41 | 41 | } |
|
42 | 42 | |
|
43 | void AreaChartItem::setPen(const QPen& pen) | |
|
44 | { | |
|
45 | m_pen = pen; | |
|
46 | } | |
|
47 | ||
|
48 | void AreaChartItem::setBrush(const QBrush& brush) | |
|
49 | { | |
|
50 | m_brush = brush; | |
|
51 | } | |
|
52 | ||
|
53 | 43 | void AreaChartItem::updatePath() |
|
54 | 44 | { |
|
55 | 45 | QPainterPath path; |
@@ -73,8 +63,8 void AreaChartItem::updatePath() | |||
|
73 | 63 | |
|
74 | 64 | void AreaChartItem::handleUpdated() |
|
75 | 65 | { |
|
76 |
|
|
|
77 |
|
|
|
66 | m_pen = m_series->pen(); | |
|
67 | m_brush = m_series->brush(); | |
|
78 | 68 | update(); |
|
79 | 69 | } |
|
80 | 70 |
@@ -22,8 +22,6 public: | |||
|
22 | 22 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
23 | 23 | QPainterPath shape() const; |
|
24 | 24 | |
|
25 | void setPen(const QPen& pen); | |
|
26 | void setBrush(const QBrush& brush); | |
|
27 | 25 | void setPointsVisible(bool visible); |
|
28 | 26 | void updatePath(); |
|
29 | 27 | public slots: |
@@ -50,8 +48,8 public: | |||
|
50 | 48 | |
|
51 | 49 | ~AreaBoundItem(){}; |
|
52 | 50 | |
|
53 |
void set |
|
|
54 |
LineChartItem::set |
|
|
51 | void setLayout(QVector<QPointF>& points){ | |
|
52 | LineChartItem::setLayout(points); | |
|
55 | 53 | m_item->updatePath(); |
|
56 | 54 | } |
|
57 | 55 |
@@ -77,18 +77,14 void ChartTheme::decorate(AreaChartItem* item, QAreaSeries* series, int index) | |||
|
77 | 77 | QBrush brush; |
|
78 | 78 | |
|
79 | 79 | if (pen != series->pen()){ |
|
80 | item->setPen(series->pen()); | |
|
81 | } else { | |
|
82 | 80 | pen.setColor(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 1.0)); |
|
83 | 81 | pen.setWidthF(2); |
|
84 |
|
|
|
82 | series->setPen(pen); | |
|
85 | 83 | } |
|
86 | 84 | |
|
87 | 85 | if (brush != series->brush()) { |
|
88 | item->setBrush(series->brush()); | |
|
89 | } else { | |
|
90 | 86 | QBrush brush(m_seriesColors.at(index % m_seriesColors.size())); |
|
91 |
|
|
|
87 | series->setBrush(brush); | |
|
92 | 88 | } |
|
93 | 89 | } |
|
94 | 90 |
@@ -29,11 +29,11 QPainterPath LineChartItem::shape() const | |||
|
29 | 29 | return m_path; |
|
30 | 30 | } |
|
31 | 31 | |
|
32 |
void LineChartItem::set |
|
|
32 | void LineChartItem::setLayout(QVector<QPointF>& points) | |
|
33 | 33 | { |
|
34 | 34 | if(points.size()==0) |
|
35 | 35 | { |
|
36 |
XYChartItem::set |
|
|
36 | XYChartItem::setLayout(points); | |
|
37 | 37 | return; |
|
38 | 38 | } |
|
39 | 39 | |
@@ -49,7 +49,7 void LineChartItem::setGeometry(QVector<QPointF>& points) | |||
|
49 | 49 | m_path = linePath; |
|
50 | 50 | m_rect = linePath.boundingRect(); |
|
51 | 51 | |
|
52 |
XYChartItem::set |
|
|
52 | XYChartItem::setLayout(points); | |
|
53 | 53 | } |
|
54 | 54 | |
|
55 | 55 | void LineChartItem::handleUpdated() |
@@ -28,7 +28,7 signals: | |||
|
28 | 28 | void clicked(const QPointF& point); |
|
29 | 29 | |
|
30 | 30 | protected: |
|
31 |
|
|
|
31 | void setLayout(QVector<QPointF>& points); | |
|
32 | 32 | void mousePressEvent( QGraphicsSceneMouseEvent * event ); |
|
33 | 33 | |
|
34 | 34 | private: |
@@ -90,11 +90,11 void ScatterChartItem::markerSelected(Marker* marker) | |||
|
90 | 90 | emit clicked(QPointF(m_series->x(marker->index()), m_series->y(marker->index()))); |
|
91 | 91 | } |
|
92 | 92 | |
|
93 |
void ScatterChartItem::set |
|
|
93 | void ScatterChartItem::setLayout(QVector<QPointF>& points) | |
|
94 | 94 | { |
|
95 | 95 | if(points.size()==0) |
|
96 | 96 | { |
|
97 |
XYChartItem::set |
|
|
97 | XYChartItem::setLayout(points); | |
|
98 | 98 | return; |
|
99 | 99 | } |
|
100 | 100 | |
@@ -127,7 +127,7 void ScatterChartItem::setGeometry(QVector<QPointF>& points) | |||
|
127 | 127 | |
|
128 | 128 | prepareGeometryChange(); |
|
129 | 129 | m_rect = clipRect(); |
|
130 |
XYChartItem::set |
|
|
130 | XYChartItem::setLayout(points); | |
|
131 | 131 | } |
|
132 | 132 | |
|
133 | 133 |
@@ -38,7 +38,7 private: | |||
|
38 | 38 | void deletePoints(int count); |
|
39 | 39 | |
|
40 | 40 | protected: |
|
41 |
|
|
|
41 | void setLayout(QVector<QPointF>& points); | |
|
42 | 42 | |
|
43 | 43 | private: |
|
44 | 44 | QScatterSeries *m_series; |
@@ -28,12 +28,12 QPointF SplineChartItem::calculateGeometryControlPoint(int index) const | |||
|
28 | 28 | return XYChartItem::calculateGeometryPoint(m_series->controlPoint(index)); |
|
29 | 29 | } |
|
30 | 30 | |
|
31 |
void SplineChartItem::set |
|
|
31 | void SplineChartItem::setLayout(QVector<QPointF>& points) | |
|
32 | 32 | { |
|
33 | 33 | |
|
34 | 34 | if(points.size()==0) |
|
35 | 35 | { |
|
36 |
XYChartItem::set |
|
|
36 | XYChartItem::setLayout(points); | |
|
37 | 37 | return; |
|
38 | 38 | } |
|
39 | 39 | |
@@ -50,7 +50,7 void SplineChartItem::setGeometry(QVector<QPointF>& points) | |||
|
50 | 50 | prepareGeometryChange(); |
|
51 | 51 | m_path = splinePath; |
|
52 | 52 | m_rect = splinePath.boundingRect(); |
|
53 |
XYChartItem::set |
|
|
53 | XYChartItem::setLayout(points); | |
|
54 | 54 | } |
|
55 | 55 | |
|
56 | 56 | void SplineChartItem::setLinePen(const QPen& pen) |
@@ -25,7 +25,7 public slots: | |||
|
25 | 25 | void handleUpdated(); |
|
26 | 26 | |
|
27 | 27 | protected: |
|
28 |
void set |
|
|
28 | void setLayout(QVector<QPointF>& points); | |
|
29 | 29 | |
|
30 | 30 | private: |
|
31 | 31 | QPointF calculateGeometryControlPoint(int index) const; |
@@ -65,21 +65,21 QPointF XYChartItem::calculateDomainPoint(const QPointF& point) const | |||
|
65 | 65 | return QPointF(x,y); |
|
66 | 66 | } |
|
67 | 67 | |
|
68 |
void XYChartItem:: |
|
|
68 | void XYChartItem::applyLayout(QVector<QPointF>& points) | |
|
69 | 69 | { |
|
70 | 70 | if(m_animator){ |
|
71 | 71 | m_animator->applyLayout(this,points); |
|
72 | 72 | } |
|
73 |
else |
|
|
73 | else setLayout(points); | |
|
74 | 74 | |
|
75 | 75 | } |
|
76 | 76 | |
|
77 |
void XYChartItem::update |
|
|
77 | void XYChartItem::updateLayout(QVector<QPointF>& points) | |
|
78 | 78 | { |
|
79 |
set |
|
|
79 | setLayout(points); | |
|
80 | 80 | } |
|
81 | 81 | |
|
82 |
void XYChartItem::set |
|
|
82 | void XYChartItem::setLayout(QVector<QPointF>& points) | |
|
83 | 83 | { |
|
84 | 84 | m_points = points; |
|
85 | 85 | } |
@@ -94,7 +94,7 void XYChartItem::handlePointAdded(int index) | |||
|
94 | 94 | QPointF point = calculateGeometryPoint(index); |
|
95 | 95 | QVector<QPointF> points = m_points; |
|
96 | 96 | points.insert(index,point); |
|
97 |
update |
|
|
97 | updateLayout(points); | |
|
98 | 98 | update(); |
|
99 | 99 | } |
|
100 | 100 | void XYChartItem::handlePointRemoved(int index) |
@@ -104,7 +104,7 void XYChartItem::handlePointRemoved(int index) | |||
|
104 | 104 | // QPointF point = calculateGeometryPoint(index); |
|
105 | 105 | QVector<QPointF> points = m_points; |
|
106 | 106 | points.remove(index); |
|
107 |
update |
|
|
107 | updateLayout(points); | |
|
108 | 108 | update(); |
|
109 | 109 | } |
|
110 | 110 | |
@@ -115,7 +115,7 void XYChartItem::handlePointReplaced(int index) | |||
|
115 | 115 | QPointF point = calculateGeometryPoint(index); |
|
116 | 116 | QVector<QPointF> points = m_points; |
|
117 | 117 | points.replace(index,point); |
|
118 |
update |
|
|
118 | updateLayout(points); | |
|
119 | 119 | update(); |
|
120 | 120 | } |
|
121 | 121 | |
@@ -128,7 +128,7 void XYChartItem::handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal | |||
|
128 | 128 | |
|
129 | 129 | if(isEmpty()) return; |
|
130 | 130 | QVector<QPointF> points = calculateGeometryPoints(); |
|
131 |
|
|
|
131 | applyLayout(points); | |
|
132 | 132 | update(); |
|
133 | 133 | } |
|
134 | 134 | |
@@ -141,7 +141,7 void XYChartItem::handleGeometryChanged(const QRectF& rect) | |||
|
141 | 141 | |
|
142 | 142 | if(isEmpty()) return; |
|
143 | 143 | QVector<QPointF> points = calculateGeometryPoints(); |
|
144 | updatePoints(points); | |
|
144 | applyLayout(points); | |
|
145 | 145 | update(); |
|
146 | 146 | } |
|
147 | 147 |
@@ -28,15 +28,15 public slots: | |||
|
28 | 28 | void handleGeometryChanged(const QRectF& size); |
|
29 | 29 | |
|
30 | 30 | protected: |
|
31 |
virtual void set |
|
|
31 | virtual void setLayout(QVector<QPointF>& points); | |
|
32 | 32 | QPointF calculateGeometryPoint(const QPointF& point) const; |
|
33 | 33 | QPointF calculateGeometryPoint(int index) const; |
|
34 | 34 | QPointF calculateDomainPoint(const QPointF& point) const; |
|
35 | 35 | QVector<QPointF> calculateGeometryPoints() const; |
|
36 | 36 | |
|
37 | 37 | private: |
|
38 |
void |
|
|
39 |
void update |
|
|
38 | void applyLayout(QVector<QPointF>& points); | |
|
39 | void updateLayout(QVector<QPointF>& points); | |
|
40 | 40 | inline bool isEmpty(); |
|
41 | 41 | |
|
42 | 42 | private: |
General Comments 0
You need to be logged in to leave comments.
Login now