@@ -1,21 +1,21 | |||
|
1 | 1 | TEMPLATE = subdirs |
|
2 | 2 | SUBDIRS += linechart \ |
|
3 | 3 | zoomlinechart \ |
|
4 | 4 | colorlinechart \ |
|
5 | 5 | barchart \ |
|
6 | 6 | stackedbarchart \ |
|
7 | 7 | percentbarchart \ |
|
8 | 8 | scatter \ |
|
9 | 9 | piechart \ |
|
10 | 10 | piechartcustomization \ |
|
11 | 11 | piechartdrilldown \ |
|
12 | 12 | dynamiclinechart \ |
|
13 | 13 | axischart \ |
|
14 | 14 | multichart \ |
|
15 | 15 | gdpbarchart \ |
|
16 | 16 | presenterchart \ |
|
17 | 17 | chartview \ |
|
18 | 18 | scatterinteractions \ |
|
19 |
|
|
|
19 | splinechart \ | |
|
20 | 20 | areachart \ |
|
21 | 21 | stackedbarchartdrilldown |
@@ -1,113 +1,112 | |||
|
1 | 1 | #include "linechartanimationitem_p.h" |
|
2 | 2 | #include "linechartitem_p.h" |
|
3 | 3 | #include <QPropertyAnimation> |
|
4 | 4 | #include <QTimer> |
|
5 | 5 | |
|
6 | 6 | Q_DECLARE_METATYPE(QVector<QPointF>) |
|
7 | 7 | |
|
8 | 8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
9 | 9 | |
|
10 | 10 | const static int duration = 500; |
|
11 | 11 | |
|
12 | 12 | LineChartAnimationItem::LineChartAnimationItem(QLineSeries* series,QGraphicsItem *parent): |
|
13 | 13 | LineChartItem(series,parent), |
|
14 | 14 | m_animation(new LineChartAnimatator(this,this)), |
|
15 | 15 | m_dirty(false) |
|
16 | 16 | { |
|
17 | 17 | } |
|
18 | 18 | |
|
19 | 19 | LineChartAnimationItem::~LineChartAnimationItem() |
|
20 | 20 | { |
|
21 | 21 | } |
|
22 | 22 | |
|
23 |
void LineChartAnimationItem::update |
|
|
23 | void LineChartAnimationItem::updatePoints(QVector<QPointF>& newPoints) | |
|
24 | 24 | { |
|
25 | 25 | QVector<QPointF> oldPoints = points(); |
|
26 |
LineChartItem::update |
|
|
27 | QVector<QPointF> newPoints = points(); | |
|
26 | LineChartItem::updatePoints(newPoints); | |
|
28 | 27 | |
|
29 | 28 | if(newPoints.count()==0) return; |
|
30 | 29 | oldPoints.resize(newPoints.size()); |
|
31 | 30 | |
|
32 | 31 | if(m_animation->state()!=QAbstractAnimation::Stopped){ |
|
33 | 32 | m_animation->stop(); |
|
34 | 33 | } |
|
35 | 34 | |
|
36 | 35 | m_animation->setDuration(duration); |
|
37 | 36 | m_animation->setEasingCurve(QEasingCurve::InOutBack); |
|
38 | 37 | m_animation->setKeyValueAt(0.0, qVariantFromValue(oldPoints)); |
|
39 | 38 | m_animation->setKeyValueAt(1.0, qVariantFromValue(newPoints)); |
|
40 | 39 | QTimer::singleShot(0,m_animation,SLOT(start())); |
|
41 | 40 | |
|
42 | 41 | |
|
43 | 42 | m_points = newPoints; |
|
44 | 43 | m_dirty=false; |
|
45 | 44 | |
|
46 | 45 | } |
|
47 | 46 | |
|
48 | 47 | void LineChartAnimationItem::updatePoint(int index,QPointF& newPoint) |
|
49 | 48 | { |
|
50 | 49 | |
|
51 | 50 | if(m_animation->state()!=QAbstractAnimation::Stopped){ |
|
52 | 51 | m_animation->stop(); |
|
53 | 52 | m_dirty=true; |
|
54 | 53 | } |
|
55 | 54 | |
|
56 | 55 | if(m_dirty){ |
|
57 | 56 | m_points=points(); |
|
58 | 57 | m_dirty=false; |
|
59 | 58 | } |
|
60 | 59 | |
|
61 | 60 | LineChartItem::updatePoint(index,newPoint); |
|
62 | 61 | |
|
63 | 62 | m_animation->setDuration(duration); |
|
64 | 63 | m_animation->setEasingCurve(QEasingCurve::InOutBack); |
|
65 | 64 | m_animation->setKeyValueAt(0.0, qVariantFromValue(m_points)); |
|
66 | 65 | m_animation->setKeyValueAt(1.0, qVariantFromValue( points())); |
|
67 | 66 | |
|
68 | 67 | QTimer::singleShot(0,this,SLOT(startAnimation())); |
|
69 | 68 | |
|
70 | 69 | |
|
71 | 70 | } |
|
72 | 71 | |
|
73 | 72 | void LineChartAnimationItem::startAnimation() |
|
74 | 73 | { |
|
75 | 74 | m_dirty=true; |
|
76 | 75 | m_animation->start(); |
|
77 | 76 | } |
|
78 | 77 | |
|
79 | 78 | LineChartAnimatator::LineChartAnimatator(LineChartAnimationItem *item , QObject *parent):QVariantAnimation(parent), |
|
80 | 79 | m_item(item) |
|
81 | 80 | { |
|
82 | 81 | } |
|
83 | 82 | |
|
84 | 83 | LineChartAnimatator::~LineChartAnimatator() |
|
85 | 84 | { |
|
86 | 85 | } |
|
87 | 86 | |
|
88 | 87 | QVariant LineChartAnimatator::interpolated(const QVariant &start, const QVariant & end, qreal progress ) const |
|
89 | 88 | { |
|
90 | 89 | QVector<QPointF> startVector = qVariantValue<QVector<QPointF> >(start); |
|
91 | 90 | QVector<QPointF> endVecotr = qVariantValue<QVector<QPointF> >(end); |
|
92 | 91 | QVector<QPointF> result; |
|
93 | 92 | Q_ASSERT(startVector.count() == endVecotr.count()); |
|
94 | 93 | |
|
95 | 94 | for(int i =0 ;i< startVector.count();i++){ |
|
96 | 95 | qreal x = startVector[i].x() + ((endVecotr[i].x()- startVector[i].x()) * progress);//qBound(0.0, progress, 1.0)); |
|
97 | 96 | qreal y = startVector[i].y() + ((endVecotr[i].y()- startVector[i].y()) * progress);//qBound(0.0, progress, 1.0)); |
|
98 | 97 | result << QPointF(x,y); |
|
99 | 98 | } |
|
100 | 99 | return qVariantFromValue(result); |
|
101 | 100 | } |
|
102 | 101 | |
|
103 | 102 | void LineChartAnimatator::updateCurrentValue (const QVariant & value ) |
|
104 | 103 | { |
|
105 | 104 | QVector<QPointF> vector = qVariantValue<QVector<QPointF> >(value); |
|
106 | 105 | if(state()!=QAbstractAnimation::Stopped){ //workaround |
|
107 | 106 | m_item->setGeometry(vector); |
|
108 | 107 | } |
|
109 | 108 | } |
|
110 | 109 | |
|
111 | 110 | #include "moc_linechartanimationitem_p.cpp" |
|
112 | 111 | |
|
113 | 112 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,50 +1,50 | |||
|
1 | 1 | #ifndef LINECHARTANIMATIONITEM_P_H_ |
|
2 | 2 | #define LINECHARTANIMATIONITEM_P_H_ |
|
3 | 3 | |
|
4 | 4 | #include "qchartglobal.h" |
|
5 | 5 | #include "linechartitem_p.h" |
|
6 | 6 | #include "domain_p.h" |
|
7 | 7 | #include <QVariantAnimation> |
|
8 | 8 | |
|
9 | 9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
10 | 10 | |
|
11 | 11 | class LineChartAnimatator; |
|
12 | 12 | |
|
13 | 13 | class LineChartAnimationItem : public LineChartItem { |
|
14 | 14 | |
|
15 | 15 | Q_OBJECT |
|
16 | 16 | |
|
17 | 17 | public: |
|
18 | 18 | LineChartAnimationItem(QLineSeries *series, QGraphicsItem *parent = 0); |
|
19 | 19 | virtual ~LineChartAnimationItem(); |
|
20 | 20 | |
|
21 | 21 | protected: |
|
22 |
virtual void update |
|
|
22 | virtual void updatePoints(QVector<QPointF>& newPoints); | |
|
23 | 23 | virtual void updatePoint(int index,QPointF& newPoint); |
|
24 | 24 | |
|
25 | 25 | private slots: |
|
26 | 26 | void startAnimation(); |
|
27 | 27 | |
|
28 | 28 | private: |
|
29 | 29 | LineChartAnimatator *m_animation; |
|
30 | 30 | QVector<QPointF> m_points; |
|
31 | 31 | bool m_dirty; |
|
32 | 32 | }; |
|
33 | 33 | |
|
34 | 34 | class LineChartAnimatator: public QVariantAnimation |
|
35 | 35 | { |
|
36 | 36 | public: |
|
37 | 37 | LineChartAnimatator(LineChartAnimationItem *item, QObject *parent = 0 ); |
|
38 | 38 | ~LineChartAnimatator(); |
|
39 | 39 | |
|
40 | 40 | protected: |
|
41 | 41 | QVariant interpolated(const QVariant &start, const QVariant & end, qreal progress ) const; |
|
42 | 42 | void updateCurrentValue (const QVariant & value ); |
|
43 | 43 | |
|
44 | 44 | private: |
|
45 | 45 | LineChartAnimationItem* m_item; |
|
46 | 46 | }; |
|
47 | 47 | |
|
48 | 48 | QTCOMMERCIALCHART_END_NAMESPACE |
|
49 | 49 | |
|
50 | 50 | #endif |
@@ -1,245 +1,124 | |||
|
1 | 1 | #include "linechartitem_p.h" |
|
2 | 2 | #include "qlineseries.h" |
|
3 | 3 | #include "chartpresenter_p.h" |
|
4 | 4 | #include <QPainter> |
|
5 | 5 | |
|
6 | 6 | |
|
7 | 7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | 8 | |
|
9 | 9 | //TODO: optimize : remove points which are not visible |
|
10 | 10 | |
|
11 | LineChartItem::LineChartItem(QLineSeries* series,QGraphicsItem *parent):ChartItem(parent), | |
|
12 | m_minX(0), | |
|
13 | m_maxX(0), | |
|
14 | m_minY(0), | |
|
15 | m_maxY(0), | |
|
11 | LineChartItem::LineChartItem(QLineSeries* series,QGraphicsItem *parent):XYChartItem(series,parent), | |
|
16 | 12 | m_series(series), |
|
17 | 13 | m_items(this) |
|
18 | 14 | { |
|
19 | 15 | //m_items.setZValue(ChartPresenter::LineChartZValue); |
|
20 | 16 | setZValue(ChartPresenter::LineChartZValue); |
|
21 | ||
|
22 | QObject::connect(series,SIGNAL(pointReplaced(int)),this,SLOT(handlePointReplaced(int))); | |
|
23 | QObject::connect(series,SIGNAL(pointAdded(int)),this,SLOT(handlePointAdded(int))); | |
|
24 | QObject::connect(series,SIGNAL(pointRemoved(int)),this,SLOT(handlePointRemoved(int))); | |
|
25 | 17 | QObject::connect(series,SIGNAL(updated()),this,SLOT(handleUpdated())); |
|
26 | 18 | |
|
27 | 19 | handleUpdated(); |
|
28 | 20 | } |
|
29 | 21 | |
|
30 | 22 | QRectF LineChartItem::boundingRect() const |
|
31 | 23 | { |
|
32 | 24 | return m_rect; |
|
33 | 25 | } |
|
34 | 26 | |
|
35 | 27 | QPainterPath LineChartItem::shape() const |
|
36 | 28 | { |
|
37 | 29 | return m_path; |
|
38 | 30 | } |
|
39 | 31 | |
|
40 | 32 | void LineChartItem::createPoints(int count) |
|
41 | 33 | { |
|
42 | 34 | for (int i = 0; i < count; ++i) { |
|
43 | 35 | QGraphicsRectItem* item = new QGraphicsRectItem(0,0,3,3); |
|
44 | 36 | m_items.addToGroup(item); |
|
45 | 37 | } |
|
46 | 38 | } |
|
47 | 39 | |
|
48 |
void LineChartItem:: |
|
|
40 | void LineChartItem::deletePoints(int count) | |
|
49 | 41 | { |
|
50 | 42 | QList<QGraphicsItem *> items = m_items.childItems(); |
|
51 | 43 | |
|
52 | 44 | for (int i = 0; i < count; ++i) { |
|
53 | 45 | delete(items.takeLast()); |
|
54 | 46 | } |
|
55 | 47 | } |
|
56 | 48 | |
|
57 |
|
|
|
58 | { | |
|
59 | const qreal deltaX = m_size.width()/(m_maxX-m_minX); | |
|
60 | const qreal deltaY = m_size.height()/(m_maxY-m_minY); | |
|
61 | qreal x = (m_series->x(index) - m_minX)* deltaX; | |
|
62 | qreal y = (m_series->y(index) - m_minY)*-deltaY + m_size.height(); | |
|
63 | return QPointF(x,y); | |
|
64 | } | |
|
65 | ||
|
66 | QVector<QPointF> LineChartItem::calculateGeometryPoints() const | |
|
67 | { | |
|
68 | const qreal deltaX = m_size.width()/(m_maxX-m_minX); | |
|
69 | const qreal deltaY = m_size.height()/(m_maxY-m_minY); | |
|
70 | ||
|
71 | QVector<QPointF> points; | |
|
72 | points.reserve(m_series->count()); | |
|
73 | for (int i = 0; i < m_series->count(); ++i) { | |
|
74 | qreal x = (m_series->x(i) - m_minX)* deltaX; | |
|
75 | qreal y = (m_series->y(i) - m_minY)*-deltaY + m_size.height(); | |
|
76 | points << QPointF(x,y); | |
|
77 | } | |
|
78 | return points; | |
|
79 | } | |
|
80 | ||
|
81 | void LineChartItem::updateAllPoints() | |
|
49 | void LineChartItem::setGeometry(QVector<QPointF>& points) | |
|
82 | 50 | { |
|
83 | QVector<QPointF> points = calculateGeometryPoints(); | |
|
84 | ||
|
85 | int diff = m_points.size() - points.size(); | |
|
86 | ||
|
87 | if(diff>0) { | |
|
88 | clearPoints(diff); | |
|
89 | } | |
|
90 | else if(diff<0) { | |
|
91 | createPoints(-diff); | |
|
92 | } | |
|
93 | ||
|
94 | setGeometry(points); | |
|
95 | } | |
|
51 | if(points.size()==0) return; | |
|
96 | 52 | |
|
97 | void LineChartItem::updatePoints(QVector<QPointF>& points) | |
|
98 | { | |
|
99 | int diff = m_points.size() - points.size(); | |
|
53 | int diff = XYChartItem::points().size() - points.size(); | |
|
100 | 54 | |
|
101 | 55 |
|
|
102 |
|
|
|
56 | deletePoints(diff); | |
|
103 | 57 |
|
|
104 | 58 |
|
|
105 | 59 |
|
|
106 | 60 |
|
|
107 | 61 | |
|
108 | setGeometry(points); | |
|
109 | } | |
|
110 | ||
|
111 | void LineChartItem::updatePoint(int index,QPointF& newPoint) | |
|
112 | { | |
|
113 | m_points.replace(index,newPoint); | |
|
114 | setGeometry(m_points); | |
|
115 | } | |
|
116 | ||
|
117 | void LineChartItem::setGeometry(QVector<QPointF>& points) | |
|
118 | { | |
|
119 | if(points.size()==0) return; | |
|
120 | ||
|
121 | 62 | QList<QGraphicsItem*> items = m_items.childItems(); |
|
122 | 63 | |
|
123 | 64 | QPainterPath path; |
|
124 | 65 | const QPointF& point = points.at(0); |
|
125 | 66 | path.moveTo(point); |
|
126 | 67 | QGraphicsItem* item = items.at(0); |
|
127 | 68 | item->setPos(point.x()-1,point.y()-1); |
|
128 |
if(! |
|
|
69 | if(!clipRect().contains(point)) { | |
|
129 | 70 |
|
|
130 | }else{ | |
|
71 | } | |
|
72 | else { | |
|
131 | 73 |
|
|
132 | 74 | } |
|
133 | 75 | |
|
134 | 76 |
for(int i=1 |
|
135 | 77 | QGraphicsItem* item = items.at(i); |
|
136 | 78 | const QPointF& point = points.at(i); |
|
137 | 79 | item->setPos(point.x()-1,point.y()-1); |
|
138 |
if(! |
|
|
80 | if(!clipRect().contains(point)) { | |
|
139 | 81 |
|
|
140 |
} |
|
|
82 | } | |
|
83 | else { | |
|
141 | 84 |
|
|
142 | 85 | } |
|
143 | 86 | path.lineTo(point); |
|
144 | 87 | } |
|
145 | 88 | |
|
146 | 89 | prepareGeometryChange(); |
|
147 | 90 | m_path = path; |
|
148 | 91 | m_rect = path.boundingRect(); |
|
149 | m_points = points; | |
|
92 | ||
|
93 | XYChartItem::setGeometry(points); | |
|
150 | 94 | } |
|
151 | 95 | |
|
152 | 96 | void LineChartItem::setPen(const QPen& pen) |
|
153 | 97 | { |
|
154 | 98 | m_pen = pen; |
|
155 | 99 | } |
|
156 | 100 | |
|
157 | //handlers | |
|
158 | ||
|
159 | void LineChartItem::handlePointAdded(int index) | |
|
160 | { | |
|
161 | Q_ASSERT(index<m_series->count()); | |
|
162 | Q_ASSERT(index>=0); | |
|
163 | ||
|
164 | QPointF point = calculateGeometryPoint(index); | |
|
165 | createPoints(1); | |
|
166 | QVector<QPointF> points = m_points; | |
|
167 | points.insert(index,point); | |
|
168 | ||
|
169 | updatePoints(points); | |
|
170 | update(); | |
|
171 | } | |
|
172 | void LineChartItem::handlePointRemoved(int index) | |
|
173 | { | |
|
174 | Q_ASSERT(index<m_series->count()); | |
|
175 | Q_ASSERT(index>=0); | |
|
176 | ||
|
177 | QPointF point = calculateGeometryPoint(index); | |
|
178 | clearPoints(1); | |
|
179 | QVector<QPointF> points = m_points; | |
|
180 | points.remove(index); | |
|
181 | updatePoints(points); | |
|
182 | update(); | |
|
183 | } | |
|
184 | ||
|
185 | void LineChartItem::handlePointReplaced(int index) | |
|
186 | { | |
|
187 | Q_ASSERT(index<m_series->count()); | |
|
188 | Q_ASSERT(index>=0); | |
|
189 | QPointF point = calculateGeometryPoint(index); | |
|
190 | updatePoint(index,point); | |
|
191 | update(); | |
|
192 | } | |
|
193 | ||
|
194 | void LineChartItem::handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY) | |
|
195 | { | |
|
196 | m_minX=minX; | |
|
197 | m_maxX=maxX; | |
|
198 | m_minY=minY; | |
|
199 | m_maxY=maxY; | |
|
200 | ||
|
201 | if(isEmpty()) return; | |
|
202 | updateAllPoints(); | |
|
203 | update(); | |
|
204 | } | |
|
205 | ||
|
206 | void LineChartItem::handleGeometryChanged(const QRectF& rect) | |
|
207 | { | |
|
208 | Q_ASSERT(rect.isValid()); | |
|
209 | m_size=rect.size(); | |
|
210 | m_clipRect=rect.translated(-rect.topLeft()); | |
|
211 | setPos(rect.topLeft()); | |
|
212 | ||
|
213 | if(isEmpty()) return; | |
|
214 | updateAllPoints(); | |
|
215 | update(); | |
|
216 | } | |
|
217 | 101 | |
|
218 | 102 | void LineChartItem::handleUpdated() |
|
219 | 103 | { |
|
220 | 104 | m_items.setVisible(m_series->pointsVisible()); |
|
221 | 105 | setPen(m_series->pen()); |
|
222 | 106 | update(); |
|
223 | 107 | } |
|
224 | 108 | |
|
225 | 109 | //painter |
|
226 | 110 | |
|
227 | 111 | void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
|
228 | 112 | { |
|
229 | 113 | Q_UNUSED(widget); |
|
230 | 114 | Q_UNUSED(option); |
|
231 | 115 | painter->save(); |
|
232 | 116 | painter->setPen(m_pen); |
|
233 |
painter->setClipRect( |
|
|
117 | painter->setClipRect(clipRect()); | |
|
234 | 118 | painter->drawPath(m_path); |
|
235 | 119 | painter->restore(); |
|
236 | 120 | } |
|
237 | 121 | |
|
238 | bool LineChartItem::isEmpty() | |
|
239 | { | |
|
240 | return !m_clipRect.isValid() || m_maxX - m_minX == 0 || m_maxY - m_minY ==0 ; | |
|
241 | } | |
|
242 | ||
|
243 | 122 | #include "moc_linechartitem_p.cpp" |
|
244 | 123 | |
|
245 | 124 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,69 +1,50 | |||
|
1 | 1 | #ifndef LINECHARTITEM_H |
|
2 | 2 | #define LINECHARTITEM_H |
|
3 | 3 | |
|
4 | 4 | #include "qchartglobal.h" |
|
5 | #include "chartitem_p.h" | |
|
5 | #include "xychartitem_p.h" | |
|
6 | 6 | #include <QPen> |
|
7 | 7 | |
|
8 | 8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
9 | 9 | |
|
10 | 10 | class ChartPresenter; |
|
11 | 11 | class QLineSeries; |
|
12 | 12 | |
|
13 |
class LineChartItem : public |
|
|
13 | class LineChartItem : public XYChartItem | |
|
14 | 14 | { |
|
15 | 15 | Q_OBJECT |
|
16 | 16 | public: |
|
17 | 17 | LineChartItem(QLineSeries* series,QGraphicsItem *parent = 0); |
|
18 | 18 | ~ LineChartItem(){}; |
|
19 | 19 | |
|
20 | 20 | //from QGraphicsItem |
|
21 | 21 | QRectF boundingRect() const; |
|
22 | 22 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
23 | 23 | QPainterPath shape() const; |
|
24 | 24 | |
|
25 | 25 | void setPen(const QPen& pen); |
|
26 | 26 | void setPointsVisible(bool visible); |
|
27 | 27 | |
|
28 | void createPoints(int count); | |
|
29 | void deletePoints(int count); | |
|
30 | ||
|
28 | 31 | public slots: |
|
29 | void handlePointAdded(int index); | |
|
30 | void handlePointRemoved(int index); | |
|
31 | void handlePointReplaced(int index); | |
|
32 | 32 | void handleUpdated(); |
|
33 | void handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); | |
|
34 | void handleGeometryChanged(const QRectF& size); | |
|
35 | 33 | |
|
36 | 34 | protected: |
|
37 | virtual void updateAllPoints(); | |
|
38 | virtual void updatePoints(QVector<QPointF>& points); | |
|
39 | virtual void updatePoint(int index,QPointF& newPoint); | |
|
40 | 35 | virtual void setGeometry(QVector<QPointF>& points); |
|
41 | 36 | |
|
42 | QVector<QPointF> points() {return m_points;} | |
|
43 | void createPoints(int count); | |
|
44 | void clearPoints(int count); | |
|
45 | QPointF calculateGeometryPoint(int index) const; | |
|
46 | QVector<QPointF> calculateGeometryPoints() const; | |
|
47 | inline bool isEmpty(); | |
|
48 | ||
|
49 | protected: | |
|
50 | qreal m_minX; | |
|
51 | qreal m_maxX; | |
|
52 | qreal m_minY; | |
|
53 | qreal m_maxY; | |
|
54 | QPainterPath m_path; | |
|
55 | QRectF m_rect; | |
|
37 | private: | |
|
56 | 38 | QLineSeries* m_series; |
|
57 | QSizeF m_size; | |
|
58 | QRectF m_clipRect; | |
|
59 | 39 | QGraphicsItemGroup m_items; |
|
60 | QVector<QPointF> m_points; | |
|
40 | QPainterPath m_path; | |
|
41 | QRectF m_rect; | |
|
61 | 42 | QPen m_pen; |
|
62 | 43 | |
|
63 | 44 | friend class LineChartAnimatator; |
|
64 | 45 | |
|
65 | 46 | }; |
|
66 | 47 | |
|
67 | 48 | QTCOMMERCIALCHART_END_NAMESPACE |
|
68 | 49 | |
|
69 | 50 | #endif |
@@ -1,224 +1,117 | |||
|
1 | 1 | #include "qlineseries.h" |
|
2 | 2 | |
|
3 | 3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
4 | 4 | |
|
5 | 5 | /*! |
|
6 | 6 | \class QLineSeries |
|
7 | 7 | \brief The QLineSeries class is used for making line charts. |
|
8 | 8 | |
|
9 | 9 | \mainclass |
|
10 | 10 | |
|
11 | 11 | A line chart is used to show information as a series of data points |
|
12 | 12 | connected by straight lines. |
|
13 | 13 | |
|
14 | 14 | \image linechart.png |
|
15 | 15 | |
|
16 | 16 | Creating basic line chart is simple: |
|
17 | 17 | \code |
|
18 | 18 | QLineSeries* series = new QLineSeries(); |
|
19 | 19 | series->add(0, 6); |
|
20 | 20 | series->add(2, 4); |
|
21 | 21 | ... |
|
22 | 22 | chartView->addSeries(series); |
|
23 | 23 | \endcode |
|
24 | 24 | */ |
|
25 | 25 | |
|
26 | 26 | /*! |
|
27 | 27 | \fn virtual QSeriesType QLineSeries::type() const |
|
28 | 28 | \brief Returns type of series. |
|
29 | 29 | \sa QSeries, QSeriesType |
|
30 | 30 | */ |
|
31 | 31 | |
|
32 | 32 | /*! |
|
33 | 33 | \fn QPen QLineSeries::pen() const |
|
34 | 34 | \brief Returns the pen used to draw line for this series. |
|
35 | 35 | \sa setPen() |
|
36 | 36 | */ |
|
37 | 37 | |
|
38 | 38 | /*! |
|
39 | 39 | \fn bool QLineSeries::pointsVisible() const |
|
40 | 40 | \brief Returns if the points are drawn for this series. |
|
41 | 41 | \sa setPointsVisible() |
|
42 | 42 | */ |
|
43 | 43 | |
|
44 | 44 | |
|
45 | 45 | /*! |
|
46 | 46 | \fn void QLineSeries::pointReplaced(int index) |
|
47 | 47 | \brief \internal \a index |
|
48 | 48 | */ |
|
49 | 49 | |
|
50 | 50 | /*! |
|
51 | 51 | \fn void QLineSeries::pointAdded(int index) |
|
52 | 52 | \brief \internal \a index |
|
53 | 53 | */ |
|
54 | 54 | |
|
55 | 55 | /*! |
|
56 | 56 | \fn void QLineSeries::pointRemoved(int index) |
|
57 | 57 | \brief \internal \a index |
|
58 | 58 | */ |
|
59 | 59 | |
|
60 | 60 | /*! |
|
61 | 61 | \fn void QLineSeries::updated() |
|
62 | 62 | \brief \internal |
|
63 | 63 | */ |
|
64 | 64 | |
|
65 | 65 | /*! |
|
66 | 66 | Constructs empty series object which is a child of \a parent. |
|
67 | 67 | When series object is added to QChartView or QChart instance ownerships is transfered. |
|
68 | 68 | */ |
|
69 | QLineSeries::QLineSeries(QObject* parent):QSeries(parent), | |
|
69 | QLineSeries::QLineSeries(QObject* parent):QXYSeries(parent), | |
|
70 | 70 | m_pointsVisible(false) |
|
71 | 71 | { |
|
72 | 72 | } |
|
73 | 73 | /*! |
|
74 | 74 | Destroys the object. Series added to QChartView or QChart instances are owned by those, |
|
75 | 75 | and are deleted when mentioned object are destroyed. |
|
76 | 76 | */ |
|
77 | 77 | QLineSeries::~QLineSeries() |
|
78 | 78 | { |
|
79 | 79 | } |
|
80 | 80 | |
|
81 | 81 | /*! |
|
82 | Adds data point \a x \a y to the series. Points are connected with lines on the chart. | |
|
83 | */ | |
|
84 | void QLineSeries::add(qreal x,qreal y) | |
|
85 | { | |
|
86 | Q_ASSERT(m_x.size() == m_y.size()); | |
|
87 | m_x<<x; | |
|
88 | m_y<<y; | |
|
89 | emit pointAdded(m_x.size()-1); | |
|
90 | } | |
|
91 | ||
|
92 | /*! | |
|
93 | This is an overloaded function. | |
|
94 | Adds data \a point to the series. Points are connected with lines on the chart. | |
|
95 | */ | |
|
96 | void QLineSeries::add(const QPointF& point) | |
|
97 | { | |
|
98 | add(point.x(),point.y()); | |
|
99 | } | |
|
100 | ||
|
101 | /*! | |
|
102 | Modifies \a y value for given \a x a value. | |
|
103 | */ | |
|
104 | void QLineSeries::replace(qreal x,qreal y) | |
|
105 | { | |
|
106 | int index = m_x.indexOf(x); | |
|
107 | m_x[index]=x; | |
|
108 | m_y[index]=y; | |
|
109 | emit pointReplaced(index); | |
|
110 | } | |
|
111 | ||
|
112 | /*! | |
|
113 | This is an overloaded function. | |
|
114 | Replaces current y value of for given \a point x value with \a point y value. | |
|
115 | */ | |
|
116 | void QLineSeries::replace(const QPointF& point) | |
|
117 | { | |
|
118 | replace(point.x(),point.y()); | |
|
119 | } | |
|
120 | ||
|
121 | /*! | |
|
122 | Removes current \a x and y value. | |
|
123 | */ | |
|
124 | void QLineSeries::remove(qreal x) | |
|
125 | { | |
|
126 | int index = m_x.indexOf(x); | |
|
127 | emit pointRemoved(index); | |
|
128 | m_x.remove(index); | |
|
129 | m_y.remove(index); | |
|
130 | } | |
|
131 | ||
|
132 | /*! | |
|
133 | Removes current \a point x value. Note \a point y value is ignored. | |
|
134 | */ | |
|
135 | void QLineSeries::remove(const QPointF& point) | |
|
136 | { | |
|
137 | remove(point.x()); | |
|
138 | } | |
|
139 | ||
|
140 | /*! | |
|
141 | Clears all the data. | |
|
142 | */ | |
|
143 | void QLineSeries::clear() | |
|
144 | { | |
|
145 | m_x.clear(); | |
|
146 | m_y.clear(); | |
|
147 | } | |
|
148 | ||
|
149 | /*! | |
|
150 | \internal \a pos | |
|
151 | */ | |
|
152 | qreal QLineSeries::x(int pos) const | |
|
153 | { | |
|
154 | return m_x.at(pos); | |
|
155 | } | |
|
156 | ||
|
157 | /*! | |
|
158 | \internal \a pos | |
|
159 | */ | |
|
160 | qreal QLineSeries::y(int pos) const | |
|
161 | { | |
|
162 | return m_y.at(pos); | |
|
163 | } | |
|
164 | ||
|
165 | /*! | |
|
166 | Returns number of data points within series. | |
|
167 | */ | |
|
168 | int QLineSeries::count() const | |
|
169 | { | |
|
170 | Q_ASSERT(m_x.size() == m_y.size()); | |
|
171 | ||
|
172 | return m_x.size(); | |
|
173 | ||
|
174 | } | |
|
175 | ||
|
176 | /*! | |
|
177 | 82 | Sets \a pen used for drawing given series.. |
|
178 | 83 | */ |
|
179 | 84 | void QLineSeries::setPen(const QPen& pen) |
|
180 | 85 | { |
|
181 | 86 | if(pen!=m_pen){ |
|
182 | 87 | m_pen=pen; |
|
183 | 88 | emit updated(); |
|
184 | 89 | } |
|
185 | 90 | } |
|
186 | 91 | |
|
187 | 92 | /*! |
|
188 | 93 | Sets if data points are \a visible and should be drawn on line. |
|
189 | 94 | */ |
|
190 | 95 | void QLineSeries::setPointsVisible(bool visible) |
|
191 | 96 | { |
|
192 | 97 | if(m_pointsVisible!=visible){ |
|
193 | 98 | m_pointsVisible=visible; |
|
194 | 99 | emit updated(); |
|
195 | 100 | } |
|
196 | 101 | } |
|
197 | 102 | |
|
198 | 103 | QDebug operator<< (QDebug debug, const QLineSeries series) |
|
199 | 104 | { |
|
200 | 105 |
|
|
201 | 106 | |
|
202 | 107 | int size = series.m_x.size(); |
|
203 | 108 | |
|
204 | 109 | for (int i=0;i<size;i++) { |
|
205 | 110 | debug.nospace() << "(" << series.m_x.at(i) << ','<< series.m_y.at(i) << ") "; |
|
206 | 111 | } |
|
207 | 112 | return debug.space(); |
|
208 | 113 | } |
|
209 | 114 | |
|
210 | /*! | |
|
211 | Stream operator for adding a data \a point to the series. | |
|
212 | \sa add() | |
|
213 | */ | |
|
214 | ||
|
215 | QLineSeries& QLineSeries::operator<< (const QPointF &point) | |
|
216 | { | |
|
217 | add(point); | |
|
218 | return *this; | |
|
219 | } | |
|
220 | ||
|
221 | ||
|
222 | 115 | #include "moc_qlineseries.cpp" |
|
223 | 116 | |
|
224 | 117 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,60 +1,35 | |||
|
1 | 1 | #ifndef QLINESERIES_H_ |
|
2 | 2 | #define QLINESERIES_H_ |
|
3 | 3 | |
|
4 | 4 | #include "qchartglobal.h" |
|
5 | #include "qseries.h" | |
|
5 | #include "qxyseries.h" | |
|
6 | 6 | #include <QDebug> |
|
7 | 7 | #include <QPen> |
|
8 | 8 | #include <QBrush> |
|
9 | 9 | |
|
10 | 10 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
11 | 11 | |
|
12 | class QTCOMMERCIALCHART_EXPORT QLineSeries : public QSeries | |
|
12 | class QTCOMMERCIALCHART_EXPORT QLineSeries : public QXYSeries | |
|
13 | 13 | { |
|
14 | 14 | Q_OBJECT |
|
15 | 15 | public: |
|
16 | 16 | QLineSeries(QObject* parent=0); |
|
17 | 17 | virtual ~QLineSeries(); |
|
18 | 18 | |
|
19 | 19 | public: // from QChartSeries |
|
20 | 20 | virtual QSeriesType type() const {return QSeries::SeriesTypeLine;} |
|
21 | void add(qreal x, qreal y); | |
|
22 | void add(const QPointF& point); | |
|
23 | void replace(qreal x,qreal y); | |
|
24 | void replace(const QPointF& point); | |
|
25 | void remove(qreal x); | |
|
26 | void remove(const QPointF& point); | |
|
27 | void clear(); | |
|
28 | ||
|
29 | 21 | void setPen(const QPen& pen); |
|
30 | 22 | QPen pen() const {return m_pen;} |
|
31 | 23 | |
|
32 | 24 | void setPointsVisible(bool visible); |
|
33 | 25 | bool pointsVisible() const {return m_pointsVisible;} |
|
34 | 26 | |
|
35 | int count() const; | |
|
36 | qreal x(int pos) const; | |
|
37 | qreal y(int pos) const; | |
|
38 | ||
|
39 | QLineSeries& operator << (const QPointF &point); | |
|
40 | 27 |
|
|
41 | ||
|
42 | signals: | |
|
43 | void updated(); | |
|
44 | void pointReplaced(int index); | |
|
45 | void pointRemoved(int index); | |
|
46 | void pointAdded(int index); | |
|
47 | ||
|
48 | ||
|
49 | protected: | |
|
50 | QVector<qreal> m_x; | |
|
51 | QVector<qreal> m_y; | |
|
52 | ||
|
53 | 28 | private: |
|
54 | 29 | QPen m_pen; |
|
55 | 30 | bool m_pointsVisible; |
|
56 | 31 | }; |
|
57 | 32 | |
|
58 | 33 | QTCOMMERCIALCHART_END_NAMESPACE |
|
59 | 34 | |
|
60 | 35 | #endif |
@@ -1,75 +1,84 | |||
|
1 | 1 | #include "splinechartitem_p.h" |
|
2 | 2 | #include <QPainter> |
|
3 | 3 | |
|
4 | 4 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
5 | 5 | |
|
6 | 6 | SplineChartItem::SplineChartItem(QSplineSeries* series, QGraphicsObject *parent) : |
|
7 |
|
|
|
7 | XYChartItem(series, parent), | |
|
8 | m_series(series) | |
|
8 | 9 | { |
|
9 | // | |
|
10 | 10 | } |
|
11 | 11 | |
|
12 | QRectF SplineChartItem::boundingRect() const | |
|
13 | { | |
|
14 | return m_rect; | |
|
15 | } | |
|
12 | 16 | |
|
17 | QPainterPath SplineChartItem::shape() const | |
|
18 | { | |
|
19 | return m_path; | |
|
20 | } | |
|
13 | 21 | |
|
14 | 22 | QPointF SplineChartItem::calculateGeometryControlPoint(int index) const |
|
15 | 23 | { |
|
16 | QSplineSeries* splineSeries = qobject_cast<QSplineSeries*>(m_series); | |
|
17 | const qreal deltaX = m_size.width()/(m_maxX-m_minX); | |
|
18 | const qreal deltaY = m_size.height()/(m_maxY-m_minY); | |
|
19 | qreal x = (splineSeries->controlPoint(index).x() - m_minX)* deltaX; | |
|
20 | qreal y = (splineSeries->controlPoint(index).y() - m_minY)*-deltaY + m_size.height(); | |
|
21 | return QPointF(x,y); | |
|
24 | return XYChartItem::calculateGeometryPoint(m_series->controlPoint(index)); | |
|
22 | 25 | } |
|
23 | 26 | |
|
24 | 27 | void SplineChartItem::setGeometry(QVector<QPointF>& points) |
|
25 | 28 | { |
|
26 | 29 | if(points.size()==0) return; |
|
27 | 30 | |
|
28 | 31 | QPainterPath splinePath; |
|
29 | 32 | const QPointF& point = points.at(0); |
|
30 | 33 | splinePath.moveTo(point); |
|
31 | 34 | |
|
32 | // QSplineSeries* splineSeries = qobject_cast<QSplineSeries*>(m_series); | |
|
33 | 35 | for (int i = 0; i < points.size() - 1; i++) |
|
34 | 36 | { |
|
35 | 37 | const QPointF& point = points.at(i + 1); |
|
36 | 38 | splinePath.cubicTo(calculateGeometryControlPoint(2 * i), calculateGeometryControlPoint(2 * i + 1), point); |
|
37 | 39 | } |
|
38 | 40 | |
|
39 | 41 | prepareGeometryChange(); |
|
40 | 42 | m_path = splinePath; |
|
41 | 43 | m_rect = splinePath.boundingRect(); |
|
44 | XYChartItem::setGeometry(points); | |
|
45 | } | |
|
46 | ||
|
47 | void SplineChartItem::setPen(const QPen& pen) | |
|
48 | { | |
|
49 | m_pen = pen; | |
|
42 | 50 | } |
|
43 | 51 | |
|
52 | ||
|
44 | 53 | void SplineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
|
45 | 54 | { |
|
46 | 55 | Q_UNUSED(widget); |
|
47 | 56 | Q_UNUSED(option); |
|
48 | 57 | painter->save(); |
|
49 |
painter->set |
|
|
50 | painter->setClipRect(m_clipRect); | |
|
58 | painter->setClipRect(clipRect()); | |
|
51 | 59 | painter->drawPath(m_path); |
|
52 | 60 | |
|
53 | QSplineSeries* splineSeries = qobject_cast<QSplineSeries*>(m_series); | |
|
54 | for (int i = 0; i < m_points.size() - 1; i++) | |
|
61 | const QVector<QPointF> points = XYChartItem::points(); | |
|
62 | ||
|
63 | for (int i = 0; i < points.size() - 1; i++) | |
|
55 | 64 | { |
|
56 | 65 | painter->setPen(Qt::red); |
|
57 |
painter->drawEllipse( |
|
|
66 | painter->drawEllipse(points[i], 2, 2); | |
|
58 | 67 | |
|
59 | 68 | painter->setPen(Qt::blue); |
|
60 | 69 | // painter->drawLine(m_series->at(i), m_series->controlPoint(2 * i)); |
|
61 | 70 | // painter->drawLine(m_series->at(i + 1), m_series->controlPoint(2 * i + 1)); |
|
62 | 71 | // painter->drawEllipse(calculateGeometryControlPoint(2 * i), 4, 4); |
|
63 | 72 | // painter->drawEllipse(calculateGeometryControlPoint(2 * i + 1), 4, 4); |
|
64 | 73 | } |
|
65 |
if ( |
|
|
74 | if (points.count() > 0) | |
|
66 | 75 | { |
|
67 | 76 | painter->setPen(Qt::red); |
|
68 |
painter->drawEllipse( |
|
|
77 | painter->drawEllipse(points[points.count() - 1], 2, 2); | |
|
69 | 78 | } |
|
70 | 79 | painter->restore(); |
|
71 | 80 | } |
|
72 | 81 | |
|
73 | 82 | #include "moc_splinechartitem_p.cpp" |
|
74 | 83 | |
|
75 | 84 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,28 +1,40 | |||
|
1 | 1 | #ifndef SPLINECHARTITEM_P_H |
|
2 | 2 | #define SPLINECHARTITEM_P_H |
|
3 | 3 | |
|
4 | 4 | #include "chartitem_p.h" |
|
5 | 5 | #include <QObject> |
|
6 | 6 | #include "qsplineseries.h" |
|
7 |
#include " |
|
|
7 | #include "xychartitem_p.h" | |
|
8 | 8 | |
|
9 | 9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
10 | 10 | |
|
11 |
class SplineChartItem : public |
|
|
11 | class SplineChartItem : public XYChartItem | |
|
12 | 12 | { |
|
13 | 13 | Q_OBJECT |
|
14 | 14 | public: |
|
15 | 15 | SplineChartItem(QSplineSeries* series, QGraphicsObject *parent = 0); |
|
16 | 16 | |
|
17 | void updateGeometry(); | |
|
17 | //from QGraphicsItem | |
|
18 | QRectF boundingRect() const; | |
|
19 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | |
|
20 | QPainterPath shape() const; | |
|
21 | ||
|
22 | void setPen(const QPen& pen); | |
|
23 | void setPointsVisible(bool visible); | |
|
18 | 24 | |
|
25 | protected: | |
|
19 | 26 | void setGeometry(QVector<QPointF>& points); |
|
20 | 27 | |
|
28 | private: | |
|
21 | 29 | QPointF calculateGeometryControlPoint(int index) const; |
|
22 | 30 | |
|
23 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | |
|
31 | private: | |
|
32 | QSplineSeries* m_series; | |
|
33 | QPainterPath m_path; | |
|
34 | QRectF m_rect; | |
|
35 | QPen m_pen; | |
|
24 | 36 | }; |
|
25 | 37 | |
|
26 | 38 | QTCOMMERCIALCHART_END_NAMESPACE |
|
27 | 39 | |
|
28 | 40 | #endif // SPLINECHARTITEM_P_H |
@@ -1,94 +1,95 | |||
|
1 | 1 | !include( ../common.pri ):error( Couldn't find the common.pri file! ) |
|
2 | 2 | TARGET = QtCommercialChart |
|
3 | 3 | DESTDIR = $$CHART_BUILD_LIB_DIR |
|
4 | 4 | TEMPLATE = lib |
|
5 | 5 | QT += core \ |
|
6 | 6 | gui |
|
7 | 7 | CONFIG += debug_and_release |
|
8 | 8 | CONFIG(debug, debug|release):TARGET = QtCommercialChartd |
|
9 | 9 | SOURCES += axisitem.cpp \ |
|
10 | 10 | axisanimationitem.cpp \ |
|
11 | 11 | chartdataset.cpp \ |
|
12 | 12 | chartpresenter.cpp \ |
|
13 | 13 | charttheme.cpp \ |
|
14 | 14 | domain.cpp \ |
|
15 | 15 | qchart.cpp \ |
|
16 | 16 | qchartaxis.cpp \ |
|
17 | 17 | qchartaxiscategories.cpp \ |
|
18 | 18 | qchartview.cpp \ |
|
19 | 19 | qseries.cpp |
|
20 | 20 | PRIVATE_HEADERS += axisitem_p.h \ |
|
21 | 21 | axisanimationitem_p.h \ |
|
22 | 22 | chartdataset_p.h \ |
|
23 | 23 | chartitem_p.h \ |
|
24 | 24 | chartpresenter_p.h \ |
|
25 | 25 | charttheme_p.h \ |
|
26 | 26 | domain_p.h |
|
27 | 27 | PUBLIC_HEADERS += qchart.h \ |
|
28 | 28 | qchartaxis.h \ |
|
29 | 29 | qchartaxiscategories.h \ |
|
30 | 30 | qchartglobal.h \ |
|
31 | 31 | qseries.h \ |
|
32 | 32 | qchartview.h |
|
33 | include(xychart/xychart.pri) | |
|
33 | 34 | include(linechart/linechart.pri) |
|
34 | 35 | include(areachart/areachart.pri) |
|
35 | 36 | include(barchart/barchart.pri) |
|
36 | 37 | include(piechart/piechart.pri) |
|
37 | 38 | include(scatterseries/scatter.pri) |
|
38 | 39 | include(splinechart/splinechart.pri) |
|
39 | 40 | |
|
40 | 41 | THEMES += themes/chartthemeicy_p.h \ |
|
41 | 42 | themes/chartthemegrayscale_p.h \ |
|
42 | 43 | themes/chartthemescientific_p.h \ |
|
43 | 44 | themes/chartthemevanilla_p.h |
|
44 | 45 | HEADERS += $$PUBLIC_HEADERS |
|
45 | 46 | HEADERS += $$PRIVATE_HEADERS |
|
46 | 47 | HEADERS += $$THEMES |
|
47 | 48 | INCLUDEPATH += linechart \ |
|
48 | 49 | barchart \ |
|
49 | 50 | themes \ |
|
50 | 51 | . |
|
51 | 52 | OBJECTS_DIR = $$CHART_BUILD_DIR/lib |
|
52 | 53 | MOC_DIR = $$CHART_BUILD_DIR/lib |
|
53 | 54 | UI_DIR = $$CHART_BUILD_DIR/lib |
|
54 | 55 | RCC_DIR = $$CHART_BUILD_DIR/lib |
|
55 | 56 | DEFINES += QTCOMMERCIALCHART_LIBRARY |
|
56 | 57 | public_headers.path = $$[QT_INSTALL_HEADERS]/QtCommercialChart |
|
57 | 58 | public_headers.files = $$PUBLIC_HEADERS |
|
58 | 59 | target.path = $$[QT_INSTALL_LIBS] |
|
59 | 60 | INSTALLS += target \ |
|
60 | 61 | public_headers |
|
61 | 62 | install_build_public_headers.name = bild_public_headers |
|
62 | 63 | install_build_public_headers.output = $$CHART_BUILD_PUBLIC_HEADER_DIR/${QMAKE_FILE_BASE}.h |
|
63 | 64 | install_build_public_headers.input = PUBLIC_HEADERS |
|
64 | 65 | install_build_public_headers.commands = $$QMAKE_COPY \ |
|
65 | 66 | ${QMAKE_FILE_NAME} \ |
|
66 | 67 | $$CHART_BUILD_PUBLIC_HEADER_DIR |
|
67 | 68 | install_build_public_headers.CONFIG += target_predeps \ |
|
68 | 69 | no_link |
|
69 | 70 | install_build_private_headers.name = bild_private_headers |
|
70 | 71 | install_build_private_headers.output = $$CHART_BUILD_PRIVATE_HEADER_DIR/${QMAKE_FILE_BASE}.h |
|
71 | 72 | install_build_private_headers.input = PRIVATE_HEADERS |
|
72 | 73 | install_build_private_headers.commands = $$QMAKE_COPY \ |
|
73 | 74 | ${QMAKE_FILE_NAME} \ |
|
74 | 75 | $$CHART_BUILD_PRIVATE_HEADER_DIR |
|
75 | 76 | install_build_private_headers.CONFIG += target_predeps \ |
|
76 | 77 | no_link |
|
77 | 78 | QMAKE_EXTRA_COMPILERS += install_build_public_headers \ |
|
78 | 79 | install_build_private_headers |
|
79 | 80 | chartversion.target = qchartversion_p.h |
|
80 | 81 | chartversion.commands = @echo \ |
|
81 | 82 | "build_time" \ |
|
82 | 83 | > \ |
|
83 | 84 | $$chartversion.target; |
|
84 | 85 | chartversion.depends = $$HEADERS \ |
|
85 | 86 | $$SOURCES |
|
86 | 87 | PRE_TARGETDEPS += qchartversion_p.h |
|
87 | 88 | QMAKE_CLEAN += qchartversion_p.h |
|
88 | 89 | QMAKE_EXTRA_TARGETS += chartversion |
|
89 | 90 | unix:QMAKE_DISTCLEAN += -r \ |
|
90 | 91 | $$CHART_BUILD_HEADER_DIR \ |
|
91 | 92 | $$CHART_BUILD_LIB_DIR |
|
92 | 93 | win32:QMAKE_DISTCLEAN += /Q \ |
|
93 | 94 | $$CHART_BUILD_HEADER_DIR \ |
|
94 | 95 | $$CHART_BUILD_LIB_DIR |
General Comments 0
You need to be logged in to leave comments.
Login now