@@ -1,446 +1,450 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include <QDebug> |
|
21 | #include <QDebug> | |
22 | #include "qbarseries.h" |
|
22 | #include "qbarseries.h" | |
23 | #include "qbarset.h" |
|
23 | #include "qbarset.h" | |
24 | #include "barchartmodel_p.h" |
|
24 | #include "barchartmodel_p.h" | |
25 | #include <QAbstractItemModel> |
|
25 | #include <QAbstractItemModel> | |
26 | #include <QModelIndex> |
|
26 | #include <QModelIndex> | |
27 |
|
27 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
29 | |||
30 | /*! |
|
30 | /*! | |
31 | \class QBarSeries |
|
31 | \class QBarSeries | |
32 | \brief part of QtCommercial chart API. |
|
32 | \brief part of QtCommercial chart API. | |
33 |
|
33 | |||
34 | QBarSeries represents a series of data shown as bars. One QBarSeries can contain multible |
|
34 | QBarSeries represents a series of data shown as bars. One QBarSeries can contain multible | |
35 | QBarSet data sets. QBarSeries groups the data from sets to categories, which are defined |
|
35 | QBarSet data sets. QBarSeries groups the data from sets to categories, which are defined | |
36 | by QStringList. |
|
36 | by QStringList. | |
37 |
|
37 | |||
38 | \mainclass |
|
38 | \mainclass | |
39 |
|
39 | |||
40 | \sa QBarSet, QStackedBarSeries, QPercentBarSeries |
|
40 | \sa QBarSet, QStackedBarSeries, QPercentBarSeries | |
41 | */ |
|
41 | */ | |
42 |
|
42 | |||
43 | /*! |
|
43 | /*! | |
44 | \fn virtual QSeriesType QBarSeries::type() const |
|
44 | \fn virtual QSeriesType QBarSeries::type() const | |
45 | \brief Returns type of series. |
|
45 | \brief Returns type of series. | |
46 | \sa QSeries, QSeriesType |
|
46 | \sa QSeries, QSeriesType | |
47 | */ |
|
47 | */ | |
48 |
|
48 | |||
49 | /*! |
|
49 | /*! | |
50 | \fn void QBarSeries::showToolTip(QPoint pos, QString tip) |
|
50 | \fn void QBarSeries::showToolTip(QPoint pos, QString tip) | |
51 | \brief \internal \a pos \a tip |
|
51 | \brief \internal \a pos \a tip | |
52 | */ |
|
52 | */ | |
53 |
|
53 | |||
54 | /*! |
|
54 | /*! | |
55 | Constructs empty QBarSeries. Parameter \a categories defines the categories for chart. |
|
55 | Constructs empty QBarSeries. Parameter \a categories defines the categories for chart. | |
56 | QBarSeries is QObject which is a child of a \a parent. |
|
56 | QBarSeries is QObject which is a child of a \a parent. | |
57 | */ |
|
57 | */ | |
58 | QBarSeries::QBarSeries(QBarCategories categories, QObject *parent) : QSeries(parent), |
|
58 | QBarSeries::QBarSeries(QBarCategories categories, QObject *parent) : QSeries(parent), | |
59 | m_internalModel(new BarChartModel(categories, this)) |
|
59 | m_internalModel(new BarChartModel(categories, this)) | |
60 | { |
|
60 | { | |
61 | m_model = 0; |
|
61 | m_model = 0; | |
62 | m_mapCategories = -1; |
|
62 | m_mapCategories = -1; | |
63 | m_mapBarBottom = -1; |
|
63 | m_mapBarBottom = -1; | |
64 | m_mapBarTop = -1; |
|
64 | m_mapBarTop = -1; | |
65 | m_mapFirst = 0; |
|
65 | m_mapFirst = 0; | |
66 | m_mapCount = 0; |
|
66 | m_mapCount = 0; | |
67 | m_mapOrientation = Qt::Vertical; |
|
67 | m_mapOrientation = Qt::Vertical; | |
68 | } |
|
68 | } | |
69 |
|
69 | |||
70 | /*! |
|
70 | /*! | |
71 | Adds a set of bars to series. Takes ownership of \a set. |
|
71 | Adds a set of bars to series. Takes ownership of \a set. | |
72 | Connects the clicked(QString, Qt::MouseButtons) signal |
|
72 | Connects the clicked(QString, Qt::MouseButtons) signal | |
73 | of \a set to this series |
|
73 | of \a set to this series | |
74 | */ |
|
74 | */ | |
75 | void QBarSeries::appendBarSet(QBarSet *set) |
|
75 | void QBarSeries::appendBarSet(QBarSet *set) | |
76 | { |
|
76 | { | |
77 | m_internalModel->appendBarSet(set); |
|
77 | m_internalModel->appendBarSet(set); | |
78 | connect(set, SIGNAL(clicked(QString,Qt::MouseButtons)), this, SLOT(barsetClicked(QString,Qt::MouseButtons))); |
|
78 | connect(set, SIGNAL(clicked(QString,Qt::MouseButtons)), this, SLOT(barsetClicked(QString,Qt::MouseButtons))); | |
79 | connect(set, SIGNAL(valueChanged()), this, SLOT(barsetChanged())); |
|
79 | connect(set, SIGNAL(valueChanged()), this, SLOT(barsetChanged())); | |
80 | emit restructuredBars(); |
|
80 | emit restructuredBars(); | |
81 | } |
|
81 | } | |
82 |
|
82 | |||
83 | /*! |
|
83 | /*! | |
84 | Removes a set of bars from series. Releases ownership of \a set. Doesnt delete \a set. |
|
84 | Removes a set of bars from series. Releases ownership of \a set. Doesnt delete \a set. | |
85 | Disconnects the clicked(QString, Qt::MouseButtons) signal |
|
85 | Disconnects the clicked(QString, Qt::MouseButtons) signal | |
86 | of \a set from this series |
|
86 | of \a set from this series | |
87 | */ |
|
87 | */ | |
88 | void QBarSeries::removeBarSet(QBarSet *set) |
|
88 | void QBarSeries::removeBarSet(QBarSet *set) | |
89 | { |
|
89 | { | |
90 | disconnect(set, SIGNAL(clicked(QString,Qt::MouseButtons)), this, SLOT(barsetClicked(QString,Qt::MouseButtons))); |
|
90 | disconnect(set, SIGNAL(clicked(QString,Qt::MouseButtons)), this, SLOT(barsetClicked(QString,Qt::MouseButtons))); | |
91 | m_internalModel->removeBarSet(set); |
|
91 | m_internalModel->removeBarSet(set); | |
92 | emit restructuredBars(); |
|
92 | emit restructuredBars(); | |
93 | } |
|
93 | } | |
94 |
|
94 | |||
95 | /*! |
|
95 | /*! | |
96 | Adds a list of barsets to series. Takes ownership of \a sets. |
|
96 | Adds a list of barsets to series. Takes ownership of \a sets. | |
97 | Connects the clicked(QString, Qt::MouseButtons) signals |
|
97 | Connects the clicked(QString, Qt::MouseButtons) signals | |
98 | of \a sets to this series |
|
98 | of \a sets to this series | |
99 | */ |
|
99 | */ | |
100 | void QBarSeries::appendBarSets(QList<QBarSet* > sets) |
|
100 | void QBarSeries::appendBarSets(QList<QBarSet* > sets) | |
101 | { |
|
101 | { | |
102 | foreach (QBarSet* barset, sets) { |
|
102 | foreach (QBarSet* barset, sets) { | |
103 | m_internalModel->appendBarSet(barset); |
|
103 | m_internalModel->appendBarSet(barset); | |
104 | connect(barset, SIGNAL(clicked(QString,Qt::MouseButtons)), this, SLOT(barsetClicked(QString,Qt::MouseButtons))); |
|
104 | connect(barset, SIGNAL(clicked(QString,Qt::MouseButtons)), this, SLOT(barsetClicked(QString,Qt::MouseButtons))); | |
105 | connect(barset, SIGNAL(valueChanged()), this, SLOT(barsetChanged())); |
|
105 | connect(barset, SIGNAL(valueChanged()), this, SLOT(barsetChanged())); | |
106 | } |
|
106 | } | |
107 | emit restructuredBars(); |
|
107 | emit restructuredBars(); | |
108 | } |
|
108 | } | |
109 |
|
109 | |||
110 | /*! |
|
110 | /*! | |
111 | Removes a list of barsets from series. Releases ownership of \a set. Doesnt delete \a sets. |
|
111 | Removes a list of barsets from series. Releases ownership of \a set. Doesnt delete \a sets. | |
112 | Disconnects the clicked(QString, Qt::MouseButtons) signal |
|
112 | Disconnects the clicked(QString, Qt::MouseButtons) signal | |
113 | of \a sets from this series |
|
113 | of \a sets from this series | |
114 | */ |
|
114 | */ | |
115 | void QBarSeries::removeBarSets(QList<QBarSet* > sets) |
|
115 | void QBarSeries::removeBarSets(QList<QBarSet* > sets) | |
116 | { |
|
116 | { | |
117 | foreach (QBarSet* barset, sets) { |
|
117 | foreach (QBarSet* barset, sets) { | |
118 | disconnect(barset, SIGNAL(clicked(QString,Qt::MouseButtons)), this, SLOT(barsetClicked(QString,Qt::MouseButtons))); |
|
118 | disconnect(barset, SIGNAL(clicked(QString,Qt::MouseButtons)), this, SLOT(barsetClicked(QString,Qt::MouseButtons))); | |
119 | m_internalModel->removeBarSet(barset); |
|
119 | m_internalModel->removeBarSet(barset); | |
120 | } |
|
120 | } | |
121 | emit restructuredBars(); |
|
121 | emit restructuredBars(); | |
122 | } |
|
122 | } | |
123 |
|
123 | |||
124 | void QBarSeries::insertBarSet(int i, QBarSet *set) |
|
124 | void QBarSeries::insertBarSet(int i, QBarSet *set) | |
125 | { |
|
125 | { | |
126 | m_internalModel->insertBarSet(i, set); |
|
126 | m_internalModel->insertBarSet(i, set); | |
127 | // emit barsetChanged(); |
|
127 | // emit barsetChanged(); | |
128 | } |
|
128 | } | |
129 |
|
129 | |||
130 | void QBarSeries::insertCategory(int i, QString category) |
|
130 | void QBarSeries::insertCategory(int i, QString category) | |
131 | { |
|
131 | { | |
132 | m_internalModel->insertCategory(i, category); |
|
132 | m_internalModel->insertCategory(i, category); | |
133 | } |
|
133 | } | |
134 |
|
134 | |||
135 | void QBarSeries::removeCategory(int i) |
|
135 | void QBarSeries::removeCategory(int i) | |
136 | { |
|
136 | { | |
137 | m_internalModel->removeCategory(i); |
|
137 | m_internalModel->removeCategory(i); | |
138 | } |
|
138 | } | |
139 |
|
139 | |||
140 | /*! |
|
140 | /*! | |
141 | Returns number of sets in series. |
|
141 | Returns number of sets in series. | |
142 | */ |
|
142 | */ | |
143 | int QBarSeries::barsetCount() const |
|
143 | int QBarSeries::barsetCount() const | |
144 | { |
|
144 | { | |
145 | // if(m_model) |
|
145 | // if(m_model) | |
146 | // return m_mapBarTop - m_mapBarBottom; |
|
146 | // return m_mapBarTop - m_mapBarBottom; | |
147 | // else |
|
147 | // else | |
148 | return m_internalModel->barsetCount(); |
|
148 | return m_internalModel->barsetCount(); | |
149 | } |
|
149 | } | |
150 |
|
150 | |||
151 | /*! |
|
151 | /*! | |
152 | Returns number of categories in series |
|
152 | Returns number of categories in series | |
153 | */ |
|
153 | */ | |
154 | int QBarSeries::categoryCount() const |
|
154 | int QBarSeries::categoryCount() const | |
155 | { |
|
155 | { | |
156 | return m_internalModel->categoryCount(); |
|
156 | return m_internalModel->categoryCount(); | |
157 | } |
|
157 | } | |
158 |
|
158 | |||
159 | /*! |
|
159 | /*! | |
160 | Returns a list of sets in series. Keeps ownership of sets. |
|
160 | Returns a list of sets in series. Keeps ownership of sets. | |
161 | */ |
|
161 | */ | |
162 | QList<QBarSet*> QBarSeries::barSets() const |
|
162 | QList<QBarSet*> QBarSeries::barSets() const | |
163 | { |
|
163 | { | |
164 | return m_internalModel->barSets(); |
|
164 | return m_internalModel->barSets(); | |
165 | } |
|
165 | } | |
166 |
|
166 | |||
167 | /*! |
|
167 | /*! | |
168 | \internal \a index |
|
168 | \internal \a index | |
169 | */ |
|
169 | */ | |
170 | QBarSet* QBarSeries::barsetAt(int index) |
|
170 | QBarSet* QBarSeries::barsetAt(int index) | |
171 | { |
|
171 | { | |
172 | return m_internalModel->barsetAt(index); |
|
172 | return m_internalModel->barsetAt(index); | |
173 | } |
|
173 | } | |
174 |
|
174 | |||
175 | /*! |
|
175 | /*! | |
176 | \internal \a category |
|
176 | \internal \a category | |
177 | */ |
|
177 | */ | |
178 | QString QBarSeries::categoryName(int category) |
|
178 | QString QBarSeries::categoryName(int category) | |
179 | { |
|
179 | { | |
180 | return m_internalModel->categoryName(category); |
|
180 | return m_internalModel->categoryName(category); | |
181 | } |
|
181 | } | |
182 |
|
182 | |||
183 | /*! |
|
183 | /*! | |
184 | Enables or disables tooltip depending on parameter \a enabled. |
|
184 | Enables or disables tooltip depending on parameter \a enabled. | |
185 | Tooltip shows the name of set, when mouse is hovering on top of bar. |
|
185 | Tooltip shows the name of set, when mouse is hovering on top of bar. | |
186 | Calling without parameter \a enabled, enables the tooltip |
|
186 | Calling without parameter \a enabled, enables the tooltip | |
187 | */ |
|
187 | */ | |
188 | void QBarSeries::setToolTipEnabled(bool enabled) |
|
188 | void QBarSeries::setToolTipEnabled(bool enabled) | |
189 | { |
|
189 | { | |
190 | // TODO: what if we add sets after call to this function? Those sets won't have tooltip enabled. |
|
190 | // TODO: what if we add sets after call to this function? Those sets won't have tooltip enabled. | |
191 | if (enabled) { |
|
191 | if (enabled) { | |
192 | for (int i=0; i<m_internalModel->barsetCount(); i++) { |
|
192 | for (int i=0; i<m_internalModel->barsetCount(); i++) { | |
193 | QBarSet *set = m_internalModel->barsetAt(i); |
|
193 | QBarSet *set = m_internalModel->barsetAt(i); | |
194 | connect(set, SIGNAL(showToolTip(QPoint,QString)), this, SIGNAL(showToolTip(QPoint,QString))); |
|
194 | connect(set, SIGNAL(showToolTip(QPoint,QString)), this, SIGNAL(showToolTip(QPoint,QString))); | |
195 | } |
|
195 | } | |
196 | } else { |
|
196 | } else { | |
197 | for (int i=0; i<m_internalModel->barsetCount(); i++) { |
|
197 | for (int i=0; i<m_internalModel->barsetCount(); i++) { | |
198 | QBarSet *set = m_internalModel->barsetAt(i); |
|
198 | QBarSet *set = m_internalModel->barsetAt(i); | |
199 | disconnect(set, SIGNAL(showToolTip(QPoint,QString)), this, SIGNAL(showToolTip(QPoint,QString))); |
|
199 | disconnect(set, SIGNAL(showToolTip(QPoint,QString)), this, SIGNAL(showToolTip(QPoint,QString))); | |
200 | } |
|
200 | } | |
201 | } |
|
201 | } | |
202 | } |
|
202 | } | |
203 |
|
203 | |||
204 |
|
204 | |||
205 | /*! |
|
205 | /*! | |
206 | \internal \a category |
|
206 | \internal \a category | |
207 | */ |
|
207 | */ | |
208 | void QBarSeries::barsetClicked(QString category, Qt::MouseButtons button) |
|
208 | void QBarSeries::barsetClicked(QString category, Qt::MouseButtons button) | |
209 | { |
|
209 | { | |
210 | emit clicked(qobject_cast<QBarSet*>(sender()), category, button); |
|
210 | emit clicked(qobject_cast<QBarSet*>(sender()), category, button); | |
211 | } |
|
211 | } | |
212 |
|
212 | |||
213 | /*! |
|
213 | /*! | |
214 | \internal |
|
214 | \internal | |
215 | */ |
|
215 | */ | |
216 | qreal QBarSeries::min() |
|
216 | qreal QBarSeries::min() | |
217 | { |
|
217 | { | |
218 | return m_internalModel->min(); |
|
218 | return m_internalModel->min(); | |
219 | } |
|
219 | } | |
220 |
|
220 | |||
221 | /*! |
|
221 | /*! | |
222 | \internal |
|
222 | \internal | |
223 | */ |
|
223 | */ | |
224 | qreal QBarSeries::max() |
|
224 | qreal QBarSeries::max() | |
225 | { |
|
225 | { | |
226 | return m_internalModel->max(); |
|
226 | return m_internalModel->max(); | |
227 | } |
|
227 | } | |
228 |
|
228 | |||
229 | /*! |
|
229 | /*! | |
230 | \internal \a set \a category |
|
230 | \internal \a set \a category | |
231 | */ |
|
231 | */ | |
232 | qreal QBarSeries::valueAt(int set, int category) |
|
232 | qreal QBarSeries::valueAt(int set, int category) | |
233 | { |
|
233 | { | |
234 | return m_internalModel->valueAt(set, category); |
|
234 | return m_internalModel->valueAt(set, category); | |
235 | } |
|
235 | } | |
236 |
|
236 | |||
237 | /*! |
|
237 | /*! | |
238 | \internal \a set \a category |
|
238 | \internal \a set \a category | |
239 | */ |
|
239 | */ | |
240 | qreal QBarSeries::percentageAt(int set, int category) |
|
240 | qreal QBarSeries::percentageAt(int set, int category) | |
241 | { |
|
241 | { | |
242 | return m_internalModel->percentageAt(set, category); |
|
242 | return m_internalModel->percentageAt(set, category); | |
243 | } |
|
243 | } | |
244 |
|
244 | |||
245 | /*! |
|
245 | /*! | |
246 | \internal \a category |
|
246 | \internal \a category | |
247 | */ |
|
247 | */ | |
248 | qreal QBarSeries::categorySum(int category) |
|
248 | qreal QBarSeries::categorySum(int category) | |
249 | { |
|
249 | { | |
250 | return m_internalModel->categorySum(category); |
|
250 | return m_internalModel->categorySum(category); | |
251 | } |
|
251 | } | |
252 |
|
252 | |||
253 | /*! |
|
253 | /*! | |
254 | \internal \a category |
|
254 | \internal \a category | |
255 | */ |
|
255 | */ | |
256 | qreal QBarSeries::absoluteCategorySum(int category) |
|
256 | qreal QBarSeries::absoluteCategorySum(int category) | |
257 | { |
|
257 | { | |
258 | return m_internalModel->absoluteCategorySum(category); |
|
258 | return m_internalModel->absoluteCategorySum(category); | |
259 | } |
|
259 | } | |
260 |
|
260 | |||
261 | /*! |
|
261 | /*! | |
262 | \internal |
|
262 | \internal | |
263 | */ |
|
263 | */ | |
264 | qreal QBarSeries::maxCategorySum() |
|
264 | qreal QBarSeries::maxCategorySum() | |
265 | { |
|
265 | { | |
266 | return m_internalModel->maxCategorySum(); |
|
266 | return m_internalModel->maxCategorySum(); | |
267 | } |
|
267 | } | |
268 |
|
268 | |||
269 | /*! |
|
269 | /*! | |
270 | \internal |
|
270 | \internal | |
271 | */ |
|
271 | */ | |
272 | BarChartModel& QBarSeries::modelInternal() |
|
272 | BarChartModel& QBarSeries::modelInternal() | |
273 | { |
|
273 | { | |
274 | return *m_internalModel; |
|
274 | return *m_internalModel; | |
275 | } |
|
275 | } | |
276 |
|
276 | |||
|
277 | /*! | |||
|
278 | \fn bool QBarSeries::setModel(QAbstractItemModel *model) | |||
|
279 | Sets the \a model to be used as a data source | |||
|
280 | */ | |||
277 | bool QBarSeries::setModel(QAbstractItemModel *model) |
|
281 | bool QBarSeries::setModel(QAbstractItemModel *model) | |
278 | { |
|
282 | { | |
279 | // disconnect signals from old model |
|
283 | // disconnect signals from old model | |
280 | if(m_model) |
|
284 | if(m_model) | |
281 | { |
|
285 | { | |
282 | disconnect(m_model, 0, this, 0); |
|
286 | disconnect(m_model, 0, this, 0); | |
283 | m_mapCategories = -1; |
|
287 | m_mapCategories = -1; | |
284 | m_mapBarBottom = -1; |
|
288 | m_mapBarBottom = -1; | |
285 | m_mapBarTop = -1; |
|
289 | m_mapBarTop = -1; | |
286 | m_mapFirst = 0; |
|
290 | m_mapFirst = 0; | |
287 | m_mapCount = 0; |
|
291 | m_mapCount = 0; | |
288 | m_mapOrientation = Qt::Vertical; |
|
292 | m_mapOrientation = Qt::Vertical; | |
289 | } |
|
293 | } | |
290 |
|
294 | |||
291 | // set new model |
|
295 | // set new model | |
292 | if(model) |
|
296 | if(model) | |
293 | { |
|
297 | { | |
294 | m_model = model; |
|
298 | m_model = model; | |
295 | return true; |
|
299 | return true; | |
296 | } |
|
300 | } | |
297 | else |
|
301 | else | |
298 | { |
|
302 | { | |
299 | m_model = 0; |
|
303 | m_model = 0; | |
300 | return false; |
|
304 | return false; | |
301 | } |
|
305 | } | |
302 | } |
|
306 | } | |
303 |
|
307 | |||
304 | // TODO |
|
308 | // TODO | |
305 | void QBarSeries::setModelMapping(int categories, int bottomBoundry, int topBoundry, Qt::Orientation orientation) |
|
309 | void QBarSeries::setModelMapping(int categories, int bottomBoundry, int topBoundry, Qt::Orientation orientation) | |
306 | { |
|
310 | { | |
307 | if (!m_model) |
|
311 | if (!m_model) | |
308 | return; |
|
312 | return; | |
309 |
|
313 | |||
310 | m_mapCategories = categories; |
|
314 | m_mapCategories = categories; | |
311 | m_mapBarBottom = bottomBoundry; |
|
315 | m_mapBarBottom = bottomBoundry; | |
312 | m_mapBarTop = topBoundry; |
|
316 | m_mapBarTop = topBoundry; | |
313 | // m_mapFirst = 1; |
|
317 | // m_mapFirst = 1; | |
314 | m_mapOrientation = orientation; |
|
318 | m_mapOrientation = orientation; | |
315 |
|
319 | |||
316 | // connect the signals |
|
320 | // connect the signals | |
317 | if (m_mapOrientation == Qt::Vertical) { |
|
321 | if (m_mapOrientation == Qt::Vertical) { | |
318 | m_mapCount = m_model->rowCount() - m_mapFirst; |
|
322 | m_mapCount = m_model->rowCount() - m_mapFirst; | |
319 | connect(m_model,SIGNAL(dataChanged(QModelIndex,QModelIndex)), |
|
323 | connect(m_model,SIGNAL(dataChanged(QModelIndex,QModelIndex)), | |
320 | this, SLOT(modelUpdated(QModelIndex, QModelIndex))); |
|
324 | this, SLOT(modelUpdated(QModelIndex, QModelIndex))); | |
321 | connect(m_model,SIGNAL(rowsInserted(QModelIndex, int, int)), |
|
325 | connect(m_model,SIGNAL(rowsInserted(QModelIndex, int, int)), | |
322 | this, SLOT(modelDataAdded(QModelIndex,int,int))); |
|
326 | this, SLOT(modelDataAdded(QModelIndex,int,int))); | |
323 | connect(m_model, SIGNAL(rowsRemoved(QModelIndex, int, int)), |
|
327 | connect(m_model, SIGNAL(rowsRemoved(QModelIndex, int, int)), | |
324 | this, SLOT(modelDataRemoved(QModelIndex,int,int))); |
|
328 | this, SLOT(modelDataRemoved(QModelIndex,int,int))); | |
325 | } else { |
|
329 | } else { | |
326 | m_mapCount = m_model->columnCount() - m_mapFirst; |
|
330 | m_mapCount = m_model->columnCount() - m_mapFirst; | |
327 | connect(m_model,SIGNAL(dataChanged(QModelIndex,QModelIndex)), |
|
331 | connect(m_model,SIGNAL(dataChanged(QModelIndex,QModelIndex)), | |
328 | this, SLOT(modelUpdated(QModelIndex, QModelIndex))); |
|
332 | this, SLOT(modelUpdated(QModelIndex, QModelIndex))); | |
329 | connect(m_model,SIGNAL(columnsInserted(QModelIndex, int, int)), |
|
333 | connect(m_model,SIGNAL(columnsInserted(QModelIndex, int, int)), | |
330 | this, SLOT(modelDataAdded(QModelIndex,int,int))); |
|
334 | this, SLOT(modelDataAdded(QModelIndex,int,int))); | |
331 | connect(m_model, SIGNAL(columnsRemoved(QModelIndex, int, int)), |
|
335 | connect(m_model, SIGNAL(columnsRemoved(QModelIndex, int, int)), | |
332 | this, SLOT(modelDataRemoved(QModelIndex,int,int))); |
|
336 | this, SLOT(modelDataRemoved(QModelIndex,int,int))); | |
333 | } |
|
337 | } | |
334 |
|
338 | |||
335 |
|
339 | |||
336 | // create the initial bars |
|
340 | // create the initial bars | |
337 | delete m_internalModel; |
|
341 | delete m_internalModel; | |
338 | if (m_mapOrientation == Qt::Vertical) { |
|
342 | if (m_mapOrientation == Qt::Vertical) { | |
339 | QStringList categories; |
|
343 | QStringList categories; | |
340 | for (int k = m_mapFirst; k < m_mapFirst + m_mapCount; k++) |
|
344 | for (int k = m_mapFirst; k < m_mapFirst + m_mapCount; k++) | |
341 | categories << m_model->data(m_model->index(k, m_mapCategories), Qt::DisplayRole).toString(); |
|
345 | categories << m_model->data(m_model->index(k, m_mapCategories), Qt::DisplayRole).toString(); | |
342 | m_internalModel = new BarChartModel(categories, this); |
|
346 | m_internalModel = new BarChartModel(categories, this); | |
343 |
|
347 | |||
344 | for (int i = m_mapBarBottom; i <= m_mapBarTop; i++) { |
|
348 | for (int i = m_mapBarBottom; i <= m_mapBarTop; i++) { | |
345 | QBarSet* barSet = new QBarSet(QString("Column: %1").arg(i + 1)); |
|
349 | QBarSet* barSet = new QBarSet(QString("Column: %1").arg(i + 1)); | |
346 | for(int m = m_mapFirst; m < m_mapFirst + m_mapCount; m++) |
|
350 | for(int m = m_mapFirst; m < m_mapFirst + m_mapCount; m++) | |
347 | *barSet << m_model->data(m_model->index(m, i), Qt::DisplayRole).toDouble(); |
|
351 | *barSet << m_model->data(m_model->index(m, i), Qt::DisplayRole).toDouble(); | |
348 | appendBarSet(barSet); |
|
352 | appendBarSet(barSet); | |
349 | } |
|
353 | } | |
350 | } else { |
|
354 | } else { | |
351 | QStringList categories; |
|
355 | QStringList categories; | |
352 | for (int k = m_mapFirst; k < m_mapFirst + m_mapCount; k++) |
|
356 | for (int k = m_mapFirst; k < m_mapFirst + m_mapCount; k++) | |
353 | categories << m_model->data(m_model->index(m_mapCategories, k), Qt::DisplayRole).toString(); |
|
357 | categories << m_model->data(m_model->index(m_mapCategories, k), Qt::DisplayRole).toString(); | |
354 | m_internalModel = new BarChartModel(categories, this); |
|
358 | m_internalModel = new BarChartModel(categories, this); | |
355 |
|
359 | |||
356 | for (int i = m_mapBarBottom; i <= m_mapBarTop; i++) { |
|
360 | for (int i = m_mapBarBottom; i <= m_mapBarTop; i++) { | |
357 | QBarSet* barSet = new QBarSet(QString("Row: %1").arg(i + 1)); |
|
361 | QBarSet* barSet = new QBarSet(QString("Row: %1").arg(i + 1)); | |
358 | for(int m = m_mapFirst; m < m_mapFirst + m_mapCount; m++) |
|
362 | for(int m = m_mapFirst; m < m_mapFirst + m_mapCount; m++) | |
359 | *barSet << m_model->data(m_model->index(i, m), Qt::DisplayRole).toDouble(); |
|
363 | *barSet << m_model->data(m_model->index(i, m), Qt::DisplayRole).toDouble(); | |
360 | appendBarSet(barSet); |
|
364 | appendBarSet(barSet); | |
361 | } |
|
365 | } | |
362 | } |
|
366 | } | |
363 | } |
|
367 | } | |
364 |
|
368 | |||
365 | void QBarSeries::setModelMappingShift(int first, int count) |
|
369 | void QBarSeries::setModelMappingShift(int first, int count) | |
366 | { |
|
370 | { | |
367 | m_mapFirst = first; |
|
371 | m_mapFirst = first; | |
368 | m_mapCount = count; |
|
372 | m_mapCount = count; | |
369 | } |
|
373 | } | |
370 |
|
374 | |||
371 | void QBarSeries::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight) |
|
375 | void QBarSeries::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight) | |
372 | { |
|
376 | { | |
373 | Q_UNUSED(bottomRight) |
|
377 | Q_UNUSED(bottomRight) | |
374 |
|
378 | |||
375 | if (m_mapOrientation == Qt::Vertical) |
|
379 | if (m_mapOrientation == Qt::Vertical) | |
376 | { |
|
380 | { | |
377 | // model update is relevant to BarSeries if the change was made to the part of the model that was mapped to BarSeries |
|
381 | // model update is relevant to BarSeries if the change was made to the part of the model that was mapped to BarSeries | |
378 | if (topLeft.column() >= m_mapBarBottom && topLeft.column() <= m_mapBarTop && topLeft.row() >= m_mapFirst && topLeft.row() < m_mapFirst + m_mapCount) |
|
382 | if (topLeft.column() >= m_mapBarBottom && topLeft.column() <= m_mapBarTop && topLeft.row() >= m_mapFirst && topLeft.row() < m_mapFirst + m_mapCount) | |
379 | barsetAt(topLeft.column() - m_mapBarBottom)->setValue(topLeft.row() - m_mapFirst, m_model->data(topLeft, Qt::DisplayRole).toDouble()); |
|
383 | barsetAt(topLeft.column() - m_mapBarBottom)->setValue(topLeft.row() - m_mapFirst, m_model->data(topLeft, Qt::DisplayRole).toDouble()); | |
380 | } |
|
384 | } | |
381 | else |
|
385 | else | |
382 | { |
|
386 | { | |
383 | // model update is relevant to BarSeries if the change was made to the part of the model that was mapped to BarSeries |
|
387 | // model update is relevant to BarSeries if the change was made to the part of the model that was mapped to BarSeries | |
384 | if (topLeft.row() >= m_mapBarBottom && topLeft.row() <= m_mapBarTop && topLeft.column() >= m_mapFirst && topLeft.column() < m_mapFirst + m_mapCount) |
|
388 | if (topLeft.row() >= m_mapBarBottom && topLeft.row() <= m_mapBarTop && topLeft.column() >= m_mapFirst && topLeft.column() < m_mapFirst + m_mapCount) | |
385 | barsetAt(topLeft.row() - m_mapBarBottom)->setValue(topLeft.column() - m_mapFirst, m_model->data(topLeft, Qt::DisplayRole).toDouble()); |
|
389 | barsetAt(topLeft.row() - m_mapBarBottom)->setValue(topLeft.column() - m_mapFirst, m_model->data(topLeft, Qt::DisplayRole).toDouble()); | |
386 | } |
|
390 | } | |
387 | } |
|
391 | } | |
388 |
|
392 | |||
389 | void QBarSeries::modelDataAdded(QModelIndex /*parent*/, int start, int /*end*/) |
|
393 | void QBarSeries::modelDataAdded(QModelIndex /*parent*/, int start, int /*end*/) | |
390 | { |
|
394 | { | |
391 | if (m_mapOrientation == Qt::Vertical) { |
|
395 | if (m_mapOrientation == Qt::Vertical) { | |
392 | insertCategory(start - m_mapFirst, QString("Row: %1").arg(start + 1)); |
|
396 | insertCategory(start - m_mapFirst, QString("Row: %1").arg(start + 1)); | |
393 | for (int i = 0; i <= m_mapBarTop - m_mapBarBottom; i++) { |
|
397 | for (int i = 0; i <= m_mapBarTop - m_mapBarBottom; i++) { | |
394 | barsetAt(i)->insertValue(start - m_mapFirst, m_model->data(m_model->index(start, i), Qt::DisplayRole).toDouble()); |
|
398 | barsetAt(i)->insertValue(start - m_mapFirst, m_model->data(m_model->index(start, i), Qt::DisplayRole).toDouble()); | |
395 | } |
|
399 | } | |
396 | } else { |
|
400 | } else { | |
397 | insertCategory(start - m_mapFirst, QString("Column: %1").arg(start + 1)); |
|
401 | insertCategory(start - m_mapFirst, QString("Column: %1").arg(start + 1)); | |
398 | for (int i = 0; i <= m_mapBarTop - m_mapBarBottom; i++) { |
|
402 | for (int i = 0; i <= m_mapBarTop - m_mapBarBottom; i++) { | |
399 | barsetAt(i)->insertValue(start - m_mapFirst, m_model->data(m_model->index(i, start), Qt::DisplayRole).toDouble()); |
|
403 | barsetAt(i)->insertValue(start - m_mapFirst, m_model->data(m_model->index(i, start), Qt::DisplayRole).toDouble()); | |
400 | } |
|
404 | } | |
401 | } |
|
405 | } | |
402 | emit restructuredBars(); |
|
406 | emit restructuredBars(); | |
403 | } |
|
407 | } | |
404 |
|
408 | |||
405 | void QBarSeries::modelDataRemoved(QModelIndex parent, int start, int end) |
|
409 | void QBarSeries::modelDataRemoved(QModelIndex parent, int start, int end) | |
406 | { |
|
410 | { | |
407 | Q_UNUSED(parent) |
|
411 | Q_UNUSED(parent) | |
408 | Q_UNUSED(end) |
|
412 | Q_UNUSED(end) | |
409 |
|
413 | |||
410 | removeCategory(start - m_mapFirst); |
|
414 | removeCategory(start - m_mapFirst); | |
411 | for (int i = 0; i <= m_mapBarTop - m_mapBarBottom; i++) |
|
415 | for (int i = 0; i <= m_mapBarTop - m_mapBarBottom; i++) | |
412 | { |
|
416 | { | |
413 | barsetAt(i)->removeValue(start - m_mapFirst); |
|
417 | barsetAt(i)->removeValue(start - m_mapFirst); | |
414 | } |
|
418 | } | |
415 | emit restructuredBars(); |
|
419 | emit restructuredBars(); | |
416 | } |
|
420 | } | |
417 |
|
421 | |||
418 | void QBarSeries::barsetChanged() |
|
422 | void QBarSeries::barsetChanged() | |
419 | { |
|
423 | { | |
420 | emit updatedBars(); |
|
424 | emit updatedBars(); | |
421 | } |
|
425 | } | |
422 |
|
426 | |||
423 | QBarCategories QBarSeries::categories() const |
|
427 | QBarCategories QBarSeries::categories() const | |
424 | { |
|
428 | { | |
425 | QBarCategories categories; |
|
429 | QBarCategories categories; | |
426 | int count = m_internalModel->categoryCount(); |
|
430 | int count = m_internalModel->categoryCount(); | |
427 | for (int i=1; i <= count; i++) { |
|
431 | for (int i=1; i <= count; i++) { | |
428 | categories.insert(i, m_internalModel->categoryName(i - 1)); |
|
432 | categories.insert(i, m_internalModel->categoryName(i - 1)); | |
429 | } |
|
433 | } | |
430 | return categories; |
|
434 | return categories; | |
431 | } |
|
435 | } | |
432 |
|
436 | |||
433 | /*! |
|
437 | /*! | |
434 | Sets the visibility of labels in series to \a visible |
|
438 | Sets the visibility of labels in series to \a visible | |
435 | */ |
|
439 | */ | |
436 | void QBarSeries::setLabelsVisible(bool visible) |
|
440 | void QBarSeries::setLabelsVisible(bool visible) | |
437 | { |
|
441 | { | |
438 | foreach (QBarSet* s, barSets()) { |
|
442 | foreach (QBarSet* s, barSets()) { | |
439 | s->setLabelsVisible(visible); |
|
443 | s->setLabelsVisible(visible); | |
440 | } |
|
444 | } | |
441 | } |
|
445 | } | |
442 |
|
446 | |||
443 |
|
447 | |||
444 | #include "moc_qbarseries.cpp" |
|
448 | #include "moc_qbarseries.cpp" | |
445 |
|
449 | |||
446 | QTCOMMERCIALCHART_END_NAMESPACE |
|
450 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,121 +1,120 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef BARSERIES_H |
|
21 | #ifndef BARSERIES_H | |
22 | #define BARSERIES_H |
|
22 | #define BARSERIES_H | |
23 |
|
23 | |||
24 | #include <qseries.h> |
|
24 | #include <qseries.h> | |
25 | #include <QStringList> |
|
25 | #include <QStringList> | |
26 |
|
26 | |||
27 | class QModelIndex; |
|
27 | class QModelIndex; | |
28 |
|
28 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
30 | |||
31 | typedef QStringList QBarCategories; |
|
31 | typedef QStringList QBarCategories; | |
32 |
|
32 | |||
33 | class QBarSet; |
|
33 | class QBarSet; | |
34 | class BarChartModel; |
|
34 | class BarChartModel; | |
35 | class BarCategory; |
|
35 | class BarCategory; | |
36 |
|
36 | |||
37 | // Container for series |
|
37 | // Container for series | |
38 | class QTCOMMERCIALCHART_EXPORT QBarSeries : public QSeries |
|
38 | class QTCOMMERCIALCHART_EXPORT QBarSeries : public QSeries | |
39 | { |
|
39 | { | |
40 | Q_OBJECT |
|
40 | Q_OBJECT | |
41 | public: |
|
41 | public: | |
42 | QBarSeries(QStringList categories, QObject *parent = 0); |
|
42 | QBarSeries(QStringList categories, QObject *parent = 0); | |
43 |
|
43 | |||
44 | virtual QSeriesType type() const { return QSeries::SeriesTypeBar; } |
|
44 | virtual QSeriesType type() const { return QSeries::SeriesTypeBar; } | |
45 |
|
45 | |||
46 | void appendBarSet(QBarSet *set); // Takes ownership of set |
|
46 | void appendBarSet(QBarSet *set); // Takes ownership of set | |
47 | void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set |
|
47 | void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set | |
48 | void appendBarSets(QList<QBarSet* > sets); |
|
48 | void appendBarSets(QList<QBarSet* > sets); | |
49 | void removeBarSets(QList<QBarSet* > sets); |
|
49 | void removeBarSets(QList<QBarSet* > sets); | |
50 | void insertBarSet(int i, QBarSet *set); |
|
50 | void insertBarSet(int i, QBarSet *set); | |
51 | void insertCategory(int i, QString category); |
|
51 | void insertCategory(int i, QString category); | |
52 | void removeCategory(int i); |
|
52 | void removeCategory(int i); | |
53 | int barsetCount() const; |
|
53 | int barsetCount() const; | |
54 | int categoryCount() const; |
|
54 | int categoryCount() const; | |
55 | QList<QBarSet*> barSets() const; |
|
55 | QList<QBarSet*> barSets() const; | |
56 | QBarCategories categories() const; |
|
56 | QBarCategories categories() const; | |
57 |
|
57 | |||
58 | void setLabelsVisible(bool visible = true); |
|
58 | void setLabelsVisible(bool visible = true); | |
59 |
|
59 | |||
60 | bool setModel(QAbstractItemModel *model); |
|
60 | bool setModel(QAbstractItemModel *model); | |
61 | // QAbstractItemModel *modelExt() { return m_model; } |
|
|||
62 | void setModelMapping(int categories, int bottomBoundry, int topBoundry, Qt::Orientation orientation = Qt::Vertical); |
|
61 | void setModelMapping(int categories, int bottomBoundry, int topBoundry, Qt::Orientation orientation = Qt::Vertical); | |
63 | void setModelMappingShift(int first, int count); |
|
62 | void setModelMappingShift(int first, int count); | |
64 |
|
63 | |||
65 | public: |
|
64 | public: | |
66 | // TODO: Functions below this are not part of api and will be moved |
|
65 | // TODO: Functions below this are not part of api and will be moved | |
67 | // to private implementation, when we start using it |
|
66 | // to private implementation, when we start using it | |
68 | // TODO: TO PIMPL ---> |
|
67 | // TODO: TO PIMPL ---> | |
69 | QBarSet* barsetAt(int index); |
|
68 | QBarSet* barsetAt(int index); | |
70 | QString categoryName(int category); |
|
69 | QString categoryName(int category); | |
71 | qreal min(); |
|
70 | qreal min(); | |
72 | qreal max(); |
|
71 | qreal max(); | |
73 | qreal valueAt(int set, int category); |
|
72 | qreal valueAt(int set, int category); | |
74 | qreal percentageAt(int set, int category); |
|
73 | qreal percentageAt(int set, int category); | |
75 | qreal categorySum(int category); |
|
74 | qreal categorySum(int category); | |
76 | qreal absoluteCategorySum(int category); |
|
75 | qreal absoluteCategorySum(int category); | |
77 | qreal maxCategorySum(); |
|
76 | qreal maxCategorySum(); | |
78 | BarChartModel& modelInternal(); |
|
77 | BarChartModel& modelInternal(); | |
79 | // <--- TO PIMPL |
|
78 | // <--- TO PIMPL | |
80 |
|
79 | |||
81 | Q_SIGNALS: |
|
80 | Q_SIGNALS: | |
82 | void clicked(QBarSet *barset, QString category, Qt::MouseButtons button); // Up to user of api, what to do with these signals |
|
81 | void clicked(QBarSet *barset, QString category, Qt::MouseButtons button); // Up to user of api, what to do with these signals | |
83 | void selected(); |
|
82 | void selected(); | |
84 | // |
|
83 | // | |
85 | void updatedBars(); |
|
84 | void updatedBars(); | |
86 | void restructuredBars(); |
|
85 | void restructuredBars(); | |
87 |
|
86 | |||
88 | // TODO: internal signals, these to private implementation. |
|
87 | // TODO: internal signals, these to private implementation. | |
89 | // TODO: TO PIMPL ---> |
|
88 | // TODO: TO PIMPL ---> | |
90 | void showToolTip(QPoint pos, QString tip); |
|
89 | void showToolTip(QPoint pos, QString tip); | |
91 | // <--- TO PIMPL |
|
90 | // <--- TO PIMPL | |
92 |
|
91 | |||
93 | public Q_SLOTS: |
|
92 | public Q_SLOTS: | |
94 | void setToolTipEnabled(bool enabled = true); // enables tooltips |
|
93 | void setToolTipEnabled(bool enabled = true); // enables tooltips | |
95 |
|
94 | |||
96 | // TODO: TO PIMPL ---> |
|
95 | // TODO: TO PIMPL ---> | |
97 | void barsetClicked(QString category, Qt::MouseButtons button); |
|
96 | void barsetClicked(QString category, Qt::MouseButtons button); | |
98 | // <--- TO PIMPL |
|
97 | // <--- TO PIMPL | |
99 |
|
98 | |||
100 | private Q_SLOTS: |
|
99 | private Q_SLOTS: | |
101 | // slots for updating bars when data in model changes |
|
100 | // slots for updating bars when data in model changes | |
102 | void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight); |
|
101 | void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight); | |
103 | void modelDataAdded(QModelIndex parent, int start, int end); |
|
102 | void modelDataAdded(QModelIndex parent, int start, int end); | |
104 | void modelDataRemoved(QModelIndex parent, int start, int end); |
|
103 | void modelDataRemoved(QModelIndex parent, int start, int end); | |
105 | void barsetChanged(); |
|
104 | void barsetChanged(); | |
106 |
|
105 | |||
107 | protected: |
|
106 | protected: | |
108 | BarChartModel *m_internalModel; // TODO: this may change... current "2 models" situation doesn't look good. |
|
107 | BarChartModel *m_internalModel; // TODO: this may change... current "2 models" situation doesn't look good. | |
109 |
|
108 | |||
110 | // QAbstractItemModel* m_model; |
|
109 | // QAbstractItemModel* m_model; | |
111 | int m_mapCategories; |
|
110 | int m_mapCategories; | |
112 | int m_mapBarBottom; |
|
111 | int m_mapBarBottom; | |
113 | int m_mapBarTop; |
|
112 | int m_mapBarTop; | |
114 | int m_mapFirst; |
|
113 | int m_mapFirst; | |
115 | int m_mapCount; |
|
114 | int m_mapCount; | |
116 | Qt::Orientation m_mapOrientation; |
|
115 | Qt::Orientation m_mapOrientation; | |
117 | }; |
|
116 | }; | |
118 |
|
117 | |||
119 | QTCOMMERCIALCHART_END_NAMESPACE |
|
118 | QTCOMMERCIALCHART_END_NAMESPACE | |
120 |
|
119 | |||
121 | #endif // BARSERIES_H |
|
120 | #endif // BARSERIES_H |
@@ -1,693 +1,697 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "qpieseries.h" |
|
21 | #include "qpieseries.h" | |
22 | #include "qpieseriesprivate_p.h" |
|
22 | #include "qpieseriesprivate_p.h" | |
23 | #include "qpieslice.h" |
|
23 | #include "qpieslice.h" | |
24 | #include "pieslicedata_p.h" |
|
24 | #include "pieslicedata_p.h" | |
25 | #include <QAbstractItemModel> |
|
25 | #include <QAbstractItemModel> | |
26 | #include <QDebug> |
|
26 | #include <QDebug> | |
27 |
|
27 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
29 | |||
30 | QPieSeriesPrivate::QPieSeriesPrivate(QPieSeries *parent) |
|
30 | QPieSeriesPrivate::QPieSeriesPrivate(QPieSeries *parent) | |
31 | :QObject(parent), |
|
31 | :QObject(parent), | |
32 | q_ptr(parent), |
|
32 | q_ptr(parent), | |
33 | m_pieRelativeHorPos(0.5), |
|
33 | m_pieRelativeHorPos(0.5), | |
34 | m_pieRelativeVerPos(0.5), |
|
34 | m_pieRelativeVerPos(0.5), | |
35 | m_pieRelativeSize(0.7), |
|
35 | m_pieRelativeSize(0.7), | |
36 | m_pieStartAngle(0), |
|
36 | m_pieStartAngle(0), | |
37 | m_pieEndAngle(360), |
|
37 | m_pieEndAngle(360), | |
38 | m_total(0), |
|
38 | m_total(0), | |
39 | m_mapValues(0), |
|
39 | m_mapValues(0), | |
40 | m_mapLabels(0), |
|
40 | m_mapLabels(0), | |
41 | m_mapOrientation(Qt::Horizontal) |
|
41 | m_mapOrientation(Qt::Horizontal) | |
42 | { |
|
42 | { | |
43 |
|
43 | |||
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 | QPieSeriesPrivate::~QPieSeriesPrivate() |
|
46 | QPieSeriesPrivate::~QPieSeriesPrivate() | |
47 | { |
|
47 | { | |
48 |
|
48 | |||
49 | } |
|
49 | } | |
50 |
|
50 | |||
51 | void QPieSeriesPrivate::updateDerivativeData() |
|
51 | void QPieSeriesPrivate::updateDerivativeData() | |
52 | { |
|
52 | { | |
53 | m_total = 0; |
|
53 | m_total = 0; | |
54 |
|
54 | |||
55 | // nothing to do? |
|
55 | // nothing to do? | |
56 | if (m_slices.count() == 0) |
|
56 | if (m_slices.count() == 0) | |
57 | return; |
|
57 | return; | |
58 |
|
58 | |||
59 | // calculate total |
|
59 | // calculate total | |
60 | foreach (QPieSlice* s, m_slices) |
|
60 | foreach (QPieSlice* s, m_slices) | |
61 | m_total += s->value(); |
|
61 | m_total += s->value(); | |
62 |
|
62 | |||
63 | // nothing to show.. |
|
63 | // nothing to show.. | |
64 | if (qFuzzyIsNull(m_total)) |
|
64 | if (qFuzzyIsNull(m_total)) | |
65 | return; |
|
65 | return; | |
66 |
|
66 | |||
67 | // update slice attributes |
|
67 | // update slice attributes | |
68 | qreal sliceAngle = m_pieStartAngle; |
|
68 | qreal sliceAngle = m_pieStartAngle; | |
69 | qreal pieSpan = m_pieEndAngle - m_pieStartAngle; |
|
69 | qreal pieSpan = m_pieEndAngle - m_pieStartAngle; | |
70 | QVector<QPieSlice*> changed; |
|
70 | QVector<QPieSlice*> changed; | |
71 | foreach (QPieSlice* s, m_slices) { |
|
71 | foreach (QPieSlice* s, m_slices) { | |
72 |
|
72 | |||
73 | PieSliceData data = PieSliceData::data(s); |
|
73 | PieSliceData data = PieSliceData::data(s); | |
74 | data.m_percentage = s->value() / m_total; |
|
74 | data.m_percentage = s->value() / m_total; | |
75 | data.m_angleSpan = pieSpan * data.m_percentage; |
|
75 | data.m_angleSpan = pieSpan * data.m_percentage; | |
76 | data.m_startAngle = sliceAngle; |
|
76 | data.m_startAngle = sliceAngle; | |
77 | sliceAngle += data.m_angleSpan; |
|
77 | sliceAngle += data.m_angleSpan; | |
78 |
|
78 | |||
79 | if (PieSliceData::data(s) != data) { |
|
79 | if (PieSliceData::data(s) != data) { | |
80 | PieSliceData::data(s) = data; |
|
80 | PieSliceData::data(s) = data; | |
81 | changed << s; |
|
81 | changed << s; | |
82 | } |
|
82 | } | |
83 | } |
|
83 | } | |
84 |
|
84 | |||
85 | // emit signals |
|
85 | // emit signals | |
86 | foreach (QPieSlice* s, changed) |
|
86 | foreach (QPieSlice* s, changed) | |
87 | PieSliceData::data(s).emitChangedSignal(s); |
|
87 | PieSliceData::data(s).emitChangedSignal(s); | |
88 | } |
|
88 | } | |
89 |
|
89 | |||
90 | void QPieSeriesPrivate::sliceChanged() |
|
90 | void QPieSeriesPrivate::sliceChanged() | |
91 | { |
|
91 | { | |
92 | Q_ASSERT(m_slices.contains(qobject_cast<QPieSlice *>(sender()))); |
|
92 | Q_ASSERT(m_slices.contains(qobject_cast<QPieSlice *>(sender()))); | |
93 | updateDerivativeData(); |
|
93 | updateDerivativeData(); | |
94 | } |
|
94 | } | |
95 |
|
95 | |||
96 | void QPieSeriesPrivate::sliceClicked(Qt::MouseButtons buttons) |
|
96 | void QPieSeriesPrivate::sliceClicked(Qt::MouseButtons buttons) | |
97 | { |
|
97 | { | |
98 | QPieSlice* slice = qobject_cast<QPieSlice *>(sender()); |
|
98 | QPieSlice* slice = qobject_cast<QPieSlice *>(sender()); | |
99 | Q_ASSERT(m_slices.contains(slice)); |
|
99 | Q_ASSERT(m_slices.contains(slice)); | |
100 | Q_Q(QPieSeries); |
|
100 | Q_Q(QPieSeries); | |
101 | emit q->clicked(slice, buttons); |
|
101 | emit q->clicked(slice, buttons); | |
102 | } |
|
102 | } | |
103 |
|
103 | |||
104 | void QPieSeriesPrivate::sliceHoverEnter() |
|
104 | void QPieSeriesPrivate::sliceHoverEnter() | |
105 | { |
|
105 | { | |
106 | QPieSlice* slice = qobject_cast<QPieSlice *>(sender()); |
|
106 | QPieSlice* slice = qobject_cast<QPieSlice *>(sender()); | |
107 | Q_ASSERT(m_slices.contains(slice)); |
|
107 | Q_ASSERT(m_slices.contains(slice)); | |
108 | Q_Q(QPieSeries); |
|
108 | Q_Q(QPieSeries); | |
109 | emit q->hoverEnter(slice); |
|
109 | emit q->hoverEnter(slice); | |
110 | } |
|
110 | } | |
111 |
|
111 | |||
112 | void QPieSeriesPrivate::sliceHoverLeave() |
|
112 | void QPieSeriesPrivate::sliceHoverLeave() | |
113 | { |
|
113 | { | |
114 | QPieSlice* slice = qobject_cast<QPieSlice *>(sender()); |
|
114 | QPieSlice* slice = qobject_cast<QPieSlice *>(sender()); | |
115 | Q_ASSERT(m_slices.contains(slice)); |
|
115 | Q_ASSERT(m_slices.contains(slice)); | |
116 | Q_Q(QPieSeries); |
|
116 | Q_Q(QPieSeries); | |
117 | emit q->hoverLeave(slice); |
|
117 | emit q->hoverLeave(slice); | |
118 | } |
|
118 | } | |
119 |
|
119 | |||
120 | void QPieSeriesPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight) |
|
120 | void QPieSeriesPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight) | |
121 | { |
|
121 | { | |
122 | Q_UNUSED(bottomRight) |
|
122 | Q_UNUSED(bottomRight) | |
123 | Q_Q(QPieSeries); |
|
123 | Q_Q(QPieSeries); | |
124 |
|
124 | |||
125 | if (m_mapOrientation == Qt::Vertical) |
|
125 | if (m_mapOrientation == Qt::Vertical) | |
126 | { |
|
126 | { | |
127 | if (topLeft.column() == m_mapValues) |
|
127 | if (topLeft.column() == m_mapValues) | |
128 | if (m_mapValues == m_mapLabels) |
|
128 | if (m_mapValues == m_mapLabels) | |
129 | { |
|
129 | { | |
130 | m_slices.at(topLeft.row())->setValue(q->m_model->data(topLeft, Qt::DisplayRole).toDouble()); |
|
130 | m_slices.at(topLeft.row())->setValue(q->m_model->data(topLeft, Qt::DisplayRole).toDouble()); | |
131 | m_slices.at(topLeft.row())->setLabel(q->m_model->data(topLeft, Qt::DisplayRole).toString()); |
|
131 | m_slices.at(topLeft.row())->setLabel(q->m_model->data(topLeft, Qt::DisplayRole).toString()); | |
132 | } |
|
132 | } | |
133 | else |
|
133 | else | |
134 | { |
|
134 | { | |
135 | m_slices.at(topLeft.row())->setValue(q->m_model->data(topLeft, Qt::DisplayRole).toDouble()); |
|
135 | m_slices.at(topLeft.row())->setValue(q->m_model->data(topLeft, Qt::DisplayRole).toDouble()); | |
136 | } |
|
136 | } | |
137 | else if (topLeft.column() == m_mapLabels) |
|
137 | else if (topLeft.column() == m_mapLabels) | |
138 | m_slices.at(topLeft.row())->setLabel(q->m_model->data(topLeft, Qt::DisplayRole).toString()); |
|
138 | m_slices.at(topLeft.row())->setLabel(q->m_model->data(topLeft, Qt::DisplayRole).toString()); | |
139 | } |
|
139 | } | |
140 | else |
|
140 | else | |
141 | { |
|
141 | { | |
142 | if (topLeft.row() == m_mapValues) |
|
142 | if (topLeft.row() == m_mapValues) | |
143 | if (m_mapValues == m_mapLabels) |
|
143 | if (m_mapValues == m_mapLabels) | |
144 | { |
|
144 | { | |
145 | m_slices.at(topLeft.column())->setValue(q->m_model->data(topLeft, Qt::DisplayRole).toDouble()); |
|
145 | m_slices.at(topLeft.column())->setValue(q->m_model->data(topLeft, Qt::DisplayRole).toDouble()); | |
146 | m_slices.at(topLeft.column())->setLabel(q->m_model->data(topLeft, Qt::DisplayRole).toString()); |
|
146 | m_slices.at(topLeft.column())->setLabel(q->m_model->data(topLeft, Qt::DisplayRole).toString()); | |
147 | } |
|
147 | } | |
148 | else |
|
148 | else | |
149 | { |
|
149 | { | |
150 | m_slices.at(topLeft.column())->setValue(q->m_model->data(topLeft, Qt::DisplayRole).toDouble()); |
|
150 | m_slices.at(topLeft.column())->setValue(q->m_model->data(topLeft, Qt::DisplayRole).toDouble()); | |
151 | } |
|
151 | } | |
152 | else if (topLeft.row() == m_mapLabels) |
|
152 | else if (topLeft.row() == m_mapLabels) | |
153 | m_slices.at(topLeft.column())->setLabel(q->m_model->data(topLeft, Qt::DisplayRole).toString()); |
|
153 | m_slices.at(topLeft.column())->setLabel(q->m_model->data(topLeft, Qt::DisplayRole).toString()); | |
154 | } |
|
154 | } | |
155 | } |
|
155 | } | |
156 |
|
156 | |||
157 | void QPieSeriesPrivate::modelDataAdded(QModelIndex parent, int start, int end) |
|
157 | void QPieSeriesPrivate::modelDataAdded(QModelIndex parent, int start, int end) | |
158 | { |
|
158 | { | |
159 | Q_UNUSED(parent) |
|
159 | Q_UNUSED(parent) | |
160 | Q_UNUSED(end) |
|
160 | Q_UNUSED(end) | |
161 | Q_Q(QPieSeries); |
|
161 | Q_Q(QPieSeries); | |
162 |
|
162 | |||
163 | QPieSlice* newSlice = new QPieSlice; |
|
163 | QPieSlice* newSlice = new QPieSlice; | |
164 | newSlice->setLabelVisible(true); |
|
164 | newSlice->setLabelVisible(true); | |
165 | if (m_mapOrientation == Qt::Vertical) |
|
165 | if (m_mapOrientation == Qt::Vertical) | |
166 | { |
|
166 | { | |
167 | newSlice->setValue(q->m_model->data(q->m_model->index(start, m_mapValues), Qt::DisplayRole).toDouble()); |
|
167 | newSlice->setValue(q->m_model->data(q->m_model->index(start, m_mapValues), Qt::DisplayRole).toDouble()); | |
168 | newSlice->setLabel(q->m_model->data(q->m_model->index(start, m_mapLabels), Qt::DisplayRole).toString()); |
|
168 | newSlice->setLabel(q->m_model->data(q->m_model->index(start, m_mapLabels), Qt::DisplayRole).toString()); | |
169 | } |
|
169 | } | |
170 | else |
|
170 | else | |
171 | { |
|
171 | { | |
172 | newSlice->setValue(q->m_model->data(q->m_model->index(m_mapValues, start), Qt::DisplayRole).toDouble()); |
|
172 | newSlice->setValue(q->m_model->data(q->m_model->index(m_mapValues, start), Qt::DisplayRole).toDouble()); | |
173 | newSlice->setLabel(q->m_model->data(q->m_model->index(m_mapLabels, start), Qt::DisplayRole).toString()); |
|
173 | newSlice->setLabel(q->m_model->data(q->m_model->index(m_mapLabels, start), Qt::DisplayRole).toString()); | |
174 | } |
|
174 | } | |
175 |
|
175 | |||
176 | q->insert(start, newSlice); |
|
176 | q->insert(start, newSlice); | |
177 | } |
|
177 | } | |
178 |
|
178 | |||
179 | void QPieSeriesPrivate::modelDataRemoved(QModelIndex parent, int start, int end) |
|
179 | void QPieSeriesPrivate::modelDataRemoved(QModelIndex parent, int start, int end) | |
180 | { |
|
180 | { | |
181 | Q_UNUSED(parent) |
|
181 | Q_UNUSED(parent) | |
182 | Q_UNUSED(end) |
|
182 | Q_UNUSED(end) | |
183 | Q_Q(QPieSeries); |
|
183 | Q_Q(QPieSeries); | |
184 | q->remove(m_slices.at(start)); |
|
184 | q->remove(m_slices.at(start)); | |
185 | } |
|
185 | } | |
186 |
|
186 | |||
187 |
|
187 | |||
188 |
|
188 | |||
189 | /*! |
|
189 | /*! | |
190 | \class QPieSeries |
|
190 | \class QPieSeries | |
191 | \brief Pie series API for QtCommercial Charts |
|
191 | \brief Pie series API for QtCommercial Charts | |
192 |
|
192 | |||
193 | The pie series defines a pie chart which consists of pie slices which are QPieSlice objects. |
|
193 | The pie series defines a pie chart which consists of pie slices which are QPieSlice objects. | |
194 | The slices can have any values as the QPieSeries will calculate its relative value to the sum of all slices. |
|
194 | The slices can have any values as the QPieSeries will calculate its relative value to the sum of all slices. | |
195 | The actual slice size is determined by that relative value. |
|
195 | The actual slice size is determined by that relative value. | |
196 |
|
196 | |||
197 | By default the pie is defined as a full pie but it can be a partial pie. |
|
197 | By default the pie is defined as a full pie but it can be a partial pie. | |
198 | This can be done by setting a starting angle and angle span to the series. |
|
198 | This can be done by setting a starting angle and angle span to the series. | |
199 | */ |
|
199 | */ | |
200 |
|
200 | |||
201 | /*! |
|
201 | /*! | |
202 | Constructs a series object which is a child of \a parent. |
|
202 | Constructs a series object which is a child of \a parent. | |
203 | */ |
|
203 | */ | |
204 | QPieSeries::QPieSeries(QObject *parent) : |
|
204 | QPieSeries::QPieSeries(QObject *parent) : | |
205 | QSeries(parent), |
|
205 | QSeries(parent), | |
206 | d_ptr(new QPieSeriesPrivate(this)) |
|
206 | d_ptr(new QPieSeriesPrivate(this)) | |
207 | { |
|
207 | { | |
208 |
|
208 | |||
209 | } |
|
209 | } | |
210 |
|
210 | |||
211 | /*! |
|
211 | /*! | |
212 | Destroys the object. Note that adding series to QChart transfers the ownership to the chart. |
|
212 | Destroys the object. Note that adding series to QChart transfers the ownership to the chart. | |
213 | */ |
|
213 | */ | |
214 | QPieSeries::~QPieSeries() |
|
214 | QPieSeries::~QPieSeries() | |
215 | { |
|
215 | { | |
216 | // NOTE: d_prt destroyed by QObject |
|
216 | // NOTE: d_prt destroyed by QObject | |
217 | } |
|
217 | } | |
218 |
|
218 | |||
219 | /*! |
|
219 | /*! | |
220 | Returns QChartSeries::SeriesTypePie. |
|
220 | Returns QChartSeries::SeriesTypePie. | |
221 | */ |
|
221 | */ | |
222 | QSeries::QSeriesType QPieSeries::type() const |
|
222 | QSeries::QSeriesType QPieSeries::type() const | |
223 | { |
|
223 | { | |
224 | return QSeries::SeriesTypePie; |
|
224 | return QSeries::SeriesTypePie; | |
225 | } |
|
225 | } | |
226 |
|
226 | |||
227 | /*! |
|
227 | /*! | |
228 | Sets an array of \a slices to the series replacing the existing slices. |
|
228 | Sets an array of \a slices to the series replacing the existing slices. | |
229 | Slice ownership is passed to the series. |
|
229 | Slice ownership is passed to the series. | |
230 | */ |
|
230 | */ | |
231 | void QPieSeries::replace(QList<QPieSlice*> slices) |
|
231 | void QPieSeries::replace(QList<QPieSlice*> slices) | |
232 | { |
|
232 | { | |
233 | clear(); |
|
233 | clear(); | |
234 | append(slices); |
|
234 | append(slices); | |
235 | } |
|
235 | } | |
236 |
|
236 | |||
237 | /*! |
|
237 | /*! | |
238 | Adds an array of \a slices to the series. |
|
238 | Adds an array of \a slices to the series. | |
239 | Slice ownership is passed to the series. |
|
239 | Slice ownership is passed to the series. | |
240 | */ |
|
240 | */ | |
241 | void QPieSeries::append(QList<QPieSlice*> slices) |
|
241 | void QPieSeries::append(QList<QPieSlice*> slices) | |
242 | { |
|
242 | { | |
243 | Q_D(QPieSeries); |
|
243 | Q_D(QPieSeries); | |
244 |
|
244 | |||
245 | foreach (QPieSlice* s, slices) { |
|
245 | foreach (QPieSlice* s, slices) { | |
246 | s->setParent(this); |
|
246 | s->setParent(this); | |
247 | d->m_slices << s; |
|
247 | d->m_slices << s; | |
248 | } |
|
248 | } | |
249 |
|
249 | |||
250 | d->updateDerivativeData(); |
|
250 | d->updateDerivativeData(); | |
251 |
|
251 | |||
252 | foreach (QPieSlice* s, slices) { |
|
252 | foreach (QPieSlice* s, slices) { | |
253 | connect(s, SIGNAL(changed()), d, SLOT(sliceChanged())); |
|
253 | connect(s, SIGNAL(changed()), d, SLOT(sliceChanged())); | |
254 | connect(s, SIGNAL(clicked(Qt::MouseButtons)), d, SLOT(sliceClicked(Qt::MouseButtons))); |
|
254 | connect(s, SIGNAL(clicked(Qt::MouseButtons)), d, SLOT(sliceClicked(Qt::MouseButtons))); | |
255 | connect(s, SIGNAL(hoverEnter()), d, SLOT(sliceHoverEnter())); |
|
255 | connect(s, SIGNAL(hoverEnter()), d, SLOT(sliceHoverEnter())); | |
256 | connect(s, SIGNAL(hoverLeave()), d, SLOT(sliceHoverLeave())); |
|
256 | connect(s, SIGNAL(hoverLeave()), d, SLOT(sliceHoverLeave())); | |
257 | } |
|
257 | } | |
258 |
|
258 | |||
259 | emit added(slices); |
|
259 | emit added(slices); | |
260 | } |
|
260 | } | |
261 |
|
261 | |||
262 | /*! |
|
262 | /*! | |
263 | Adds a single \a slice to the series. |
|
263 | Adds a single \a slice to the series. | |
264 | Slice ownership is passed to the series. |
|
264 | Slice ownership is passed to the series. | |
265 | */ |
|
265 | */ | |
266 | void QPieSeries::append(QPieSlice* slice) |
|
266 | void QPieSeries::append(QPieSlice* slice) | |
267 | { |
|
267 | { | |
268 | append(QList<QPieSlice*>() << slice); |
|
268 | append(QList<QPieSlice*>() << slice); | |
269 | } |
|
269 | } | |
270 |
|
270 | |||
271 | /*! |
|
271 | /*! | |
272 | Adds a single \a slice to the series and returns a reference to the series. |
|
272 | Adds a single \a slice to the series and returns a reference to the series. | |
273 | Slice ownership is passed to the series. |
|
273 | Slice ownership is passed to the series. | |
274 | */ |
|
274 | */ | |
275 | QPieSeries& QPieSeries::operator << (QPieSlice* slice) |
|
275 | QPieSeries& QPieSeries::operator << (QPieSlice* slice) | |
276 | { |
|
276 | { | |
277 | append(slice); |
|
277 | append(slice); | |
278 | return *this; |
|
278 | return *this; | |
279 | } |
|
279 | } | |
280 |
|
280 | |||
281 |
|
281 | |||
282 | /*! |
|
282 | /*! | |
283 | Appends a single slice to the series with give \a value and \a name. |
|
283 | Appends a single slice to the series with give \a value and \a name. | |
284 | Slice ownership is passed to the series. |
|
284 | Slice ownership is passed to the series. | |
285 | */ |
|
285 | */ | |
286 | QPieSlice* QPieSeries::append(qreal value, QString name) |
|
286 | QPieSlice* QPieSeries::append(qreal value, QString name) | |
287 | { |
|
287 | { | |
288 | QPieSlice* slice = new QPieSlice(value, name); |
|
288 | QPieSlice* slice = new QPieSlice(value, name); | |
289 | append(slice); |
|
289 | append(slice); | |
290 | return slice; |
|
290 | return slice; | |
291 | } |
|
291 | } | |
292 |
|
292 | |||
293 | /*! |
|
293 | /*! | |
294 | Inserts a single \a slice to the series before the slice at \a index position. |
|
294 | Inserts a single \a slice to the series before the slice at \a index position. | |
295 | Slice ownership is passed to the series. |
|
295 | Slice ownership is passed to the series. | |
296 | */ |
|
296 | */ | |
297 | void QPieSeries::insert(int index, QPieSlice* slice) |
|
297 | void QPieSeries::insert(int index, QPieSlice* slice) | |
298 | { |
|
298 | { | |
299 | Q_D(QPieSeries); |
|
299 | Q_D(QPieSeries); | |
300 | Q_ASSERT(index <= d->m_slices.count()); |
|
300 | Q_ASSERT(index <= d->m_slices.count()); | |
301 | slice->setParent(this); |
|
301 | slice->setParent(this); | |
302 | d->m_slices.insert(index, slice); |
|
302 | d->m_slices.insert(index, slice); | |
303 |
|
303 | |||
304 | d->updateDerivativeData(); |
|
304 | d->updateDerivativeData(); | |
305 |
|
305 | |||
306 | connect(slice, SIGNAL(changed()), d, SLOT(sliceChanged())); |
|
306 | connect(slice, SIGNAL(changed()), d, SLOT(sliceChanged())); | |
307 | connect(slice, SIGNAL(clicked(Qt::MouseButtons)), d, SLOT(sliceClicked(Qt::MouseButtons))); |
|
307 | connect(slice, SIGNAL(clicked(Qt::MouseButtons)), d, SLOT(sliceClicked(Qt::MouseButtons))); | |
308 | connect(slice, SIGNAL(hoverEnter()), d, SLOT(sliceHoverEnter())); |
|
308 | connect(slice, SIGNAL(hoverEnter()), d, SLOT(sliceHoverEnter())); | |
309 | connect(slice, SIGNAL(hoverLeave()), d, SLOT(sliceHoverLeave())); |
|
309 | connect(slice, SIGNAL(hoverLeave()), d, SLOT(sliceHoverLeave())); | |
310 |
|
310 | |||
311 | emit added(QList<QPieSlice*>() << slice); |
|
311 | emit added(QList<QPieSlice*>() << slice); | |
312 | } |
|
312 | } | |
313 |
|
313 | |||
314 | /*! |
|
314 | /*! | |
315 | Removes a single \a slice from the series and deletes the slice. |
|
315 | Removes a single \a slice from the series and deletes the slice. | |
316 |
|
316 | |||
317 | Do not reference this pointer after this call. |
|
317 | Do not reference this pointer after this call. | |
318 | */ |
|
318 | */ | |
319 | void QPieSeries::remove(QPieSlice* slice) |
|
319 | void QPieSeries::remove(QPieSlice* slice) | |
320 | { |
|
320 | { | |
321 | Q_D(QPieSeries); |
|
321 | Q_D(QPieSeries); | |
322 | if (!d->m_slices.removeOne(slice)) { |
|
322 | if (!d->m_slices.removeOne(slice)) { | |
323 | Q_ASSERT(0); // TODO: how should this be reported? |
|
323 | Q_ASSERT(0); // TODO: how should this be reported? | |
324 | return; |
|
324 | return; | |
325 | } |
|
325 | } | |
326 |
|
326 | |||
327 | d->updateDerivativeData(); |
|
327 | d->updateDerivativeData(); | |
328 |
|
328 | |||
329 | emit removed(QList<QPieSlice*>() << slice); |
|
329 | emit removed(QList<QPieSlice*>() << slice); | |
330 |
|
330 | |||
331 | delete slice; |
|
331 | delete slice; | |
332 | slice = 0; |
|
332 | slice = 0; | |
333 | } |
|
333 | } | |
334 |
|
334 | |||
335 | /*! |
|
335 | /*! | |
336 | Clears all slices from the series. |
|
336 | Clears all slices from the series. | |
337 | */ |
|
337 | */ | |
338 | void QPieSeries::clear() |
|
338 | void QPieSeries::clear() | |
339 | { |
|
339 | { | |
340 | Q_D(QPieSeries); |
|
340 | Q_D(QPieSeries); | |
341 | if (d->m_slices.count() == 0) |
|
341 | if (d->m_slices.count() == 0) | |
342 | return; |
|
342 | return; | |
343 |
|
343 | |||
344 | QList<QPieSlice*> slices = d->m_slices; |
|
344 | QList<QPieSlice*> slices = d->m_slices; | |
345 | foreach (QPieSlice* s, d->m_slices) { |
|
345 | foreach (QPieSlice* s, d->m_slices) { | |
346 | d->m_slices.removeOne(s); |
|
346 | d->m_slices.removeOne(s); | |
347 | delete s; |
|
347 | delete s; | |
348 | } |
|
348 | } | |
349 |
|
349 | |||
350 | d->updateDerivativeData(); |
|
350 | d->updateDerivativeData(); | |
351 |
|
351 | |||
352 | emit removed(slices); |
|
352 | emit removed(slices); | |
353 | } |
|
353 | } | |
354 |
|
354 | |||
355 | /*! |
|
355 | /*! | |
356 | Counts the number of the slices in this series. |
|
356 | Counts the number of the slices in this series. | |
357 | */ |
|
357 | */ | |
358 | int QPieSeries::count() const |
|
358 | int QPieSeries::count() const | |
359 | { |
|
359 | { | |
360 | Q_D(const QPieSeries); |
|
360 | Q_D(const QPieSeries); | |
361 | return d->m_slices.count(); |
|
361 | return d->m_slices.count(); | |
362 | } |
|
362 | } | |
363 |
|
363 | |||
364 | /*! |
|
364 | /*! | |
365 | Returns true is the series is empty. |
|
365 | Returns true is the series is empty. | |
366 | */ |
|
366 | */ | |
367 | bool QPieSeries::isEmpty() const |
|
367 | bool QPieSeries::isEmpty() const | |
368 | { |
|
368 | { | |
369 | Q_D(const QPieSeries); |
|
369 | Q_D(const QPieSeries); | |
370 | return d->m_slices.isEmpty(); |
|
370 | return d->m_slices.isEmpty(); | |
371 | } |
|
371 | } | |
372 |
|
372 | |||
373 | /*! |
|
373 | /*! | |
374 | Returns a list of slices that belong to this series. |
|
374 | Returns a list of slices that belong to this series. | |
375 | */ |
|
375 | */ | |
376 | QList<QPieSlice*> QPieSeries::slices() const |
|
376 | QList<QPieSlice*> QPieSeries::slices() const | |
377 | { |
|
377 | { | |
378 | Q_D(const QPieSeries); |
|
378 | Q_D(const QPieSeries); | |
379 | return d->m_slices; |
|
379 | return d->m_slices; | |
380 | } |
|
380 | } | |
381 |
|
381 | |||
382 | /*! |
|
382 | /*! | |
383 | Sets the center position of the pie by \a relativeHorizontalPosition and \a relativeVerticalPosition. |
|
383 | Sets the center position of the pie by \a relativeHorizontalPosition and \a relativeVerticalPosition. | |
384 |
|
384 | |||
385 | The factors are relative to the chart rectangle where: |
|
385 | The factors are relative to the chart rectangle where: | |
386 |
|
386 | |||
387 | \a relativeHorizontalPosition 0.0 means the absolute left. |
|
387 | \a relativeHorizontalPosition 0.0 means the absolute left. | |
388 | \a relativeHorizontalPosition 1.0 means the absolute right. |
|
388 | \a relativeHorizontalPosition 1.0 means the absolute right. | |
389 | \a relativeVerticalPosition 0.0 means the absolute top. |
|
389 | \a relativeVerticalPosition 0.0 means the absolute top. | |
390 | \a relativeVerticalPosition 1.0 means the absolute bottom. |
|
390 | \a relativeVerticalPosition 1.0 means the absolute bottom. | |
391 |
|
391 | |||
392 | By default both values are 0.5 which puts the pie in the middle of the chart rectangle. |
|
392 | By default both values are 0.5 which puts the pie in the middle of the chart rectangle. | |
393 |
|
393 | |||
394 | \sa pieHorizontalPosition(), pieVerticalPosition(), setPieSize() |
|
394 | \sa pieHorizontalPosition(), pieVerticalPosition(), setPieSize() | |
395 | */ |
|
395 | */ | |
396 | void QPieSeries::setPiePosition(qreal relativeHorizontalPosition, qreal relativeVerticalPosition) |
|
396 | void QPieSeries::setPiePosition(qreal relativeHorizontalPosition, qreal relativeVerticalPosition) | |
397 | { |
|
397 | { | |
398 | Q_D(QPieSeries); |
|
398 | Q_D(QPieSeries); | |
399 | if (relativeHorizontalPosition < 0.0 || relativeHorizontalPosition > 1.0 || |
|
399 | if (relativeHorizontalPosition < 0.0 || relativeHorizontalPosition > 1.0 || | |
400 | relativeVerticalPosition < 0.0 || relativeVerticalPosition > 1.0) |
|
400 | relativeVerticalPosition < 0.0 || relativeVerticalPosition > 1.0) | |
401 | return; |
|
401 | return; | |
402 |
|
402 | |||
403 | if (!qFuzzyIsNull(d->m_pieRelativeHorPos - relativeHorizontalPosition) || |
|
403 | if (!qFuzzyIsNull(d->m_pieRelativeHorPos - relativeHorizontalPosition) || | |
404 | !qFuzzyIsNull(d->m_pieRelativeVerPos - relativeVerticalPosition)) { |
|
404 | !qFuzzyIsNull(d->m_pieRelativeVerPos - relativeVerticalPosition)) { | |
405 | d->m_pieRelativeHorPos = relativeHorizontalPosition; |
|
405 | d->m_pieRelativeHorPos = relativeHorizontalPosition; | |
406 | d->m_pieRelativeVerPos = relativeVerticalPosition; |
|
406 | d->m_pieRelativeVerPos = relativeVerticalPosition; | |
407 | emit piePositionChanged(); |
|
407 | emit piePositionChanged(); | |
408 | } |
|
408 | } | |
409 | } |
|
409 | } | |
410 |
|
410 | |||
411 | /*! |
|
411 | /*! | |
412 | Gets the horizontal position of the pie. |
|
412 | Gets the horizontal position of the pie. | |
413 |
|
413 | |||
414 | The returned value is relative to the chart rectangle where: |
|
414 | The returned value is relative to the chart rectangle where: | |
415 |
|
415 | |||
416 | 0.0 means the absolute left. |
|
416 | 0.0 means the absolute left. | |
417 | 1.0 means the absolute right. |
|
417 | 1.0 means the absolute right. | |
418 |
|
418 | |||
419 | By default it is 0.5 which puts the pie in the horizontal middle of the chart rectangle. |
|
419 | By default it is 0.5 which puts the pie in the horizontal middle of the chart rectangle. | |
420 |
|
420 | |||
421 | \sa setPiePosition(), pieVerticalPosition(), setPieSize() |
|
421 | \sa setPiePosition(), pieVerticalPosition(), setPieSize() | |
422 | */ |
|
422 | */ | |
423 | qreal QPieSeries::pieHorizontalPosition() const |
|
423 | qreal QPieSeries::pieHorizontalPosition() const | |
424 | { |
|
424 | { | |
425 | Q_D(const QPieSeries); |
|
425 | Q_D(const QPieSeries); | |
426 | return d->m_pieRelativeHorPos; |
|
426 | return d->m_pieRelativeHorPos; | |
427 | } |
|
427 | } | |
428 |
|
428 | |||
429 | /*! |
|
429 | /*! | |
430 | Gets the vertical position position of the pie. |
|
430 | Gets the vertical position position of the pie. | |
431 |
|
431 | |||
432 | The returned value is relative to the chart rectangle where: |
|
432 | The returned value is relative to the chart rectangle where: | |
433 |
|
433 | |||
434 | 0.0 means the absolute top. |
|
434 | 0.0 means the absolute top. | |
435 | 1.0 means the absolute bottom. |
|
435 | 1.0 means the absolute bottom. | |
436 |
|
436 | |||
437 | By default it is 0.5 which puts the pie in the vertical middle of the chart rectangle. |
|
437 | By default it is 0.5 which puts the pie in the vertical middle of the chart rectangle. | |
438 |
|
438 | |||
439 | \sa setPiePosition(), pieHorizontalPosition(), setPieSize() |
|
439 | \sa setPiePosition(), pieHorizontalPosition(), setPieSize() | |
440 | */ |
|
440 | */ | |
441 | qreal QPieSeries::pieVerticalPosition() const |
|
441 | qreal QPieSeries::pieVerticalPosition() const | |
442 | { |
|
442 | { | |
443 | Q_D(const QPieSeries); |
|
443 | Q_D(const QPieSeries); | |
444 | return d->m_pieRelativeVerPos; |
|
444 | return d->m_pieRelativeVerPos; | |
445 | } |
|
445 | } | |
446 |
|
446 | |||
447 | /*! |
|
447 | /*! | |
448 | Sets the relative size of the pie. |
|
448 | Sets the relative size of the pie. | |
449 |
|
449 | |||
450 | The \a relativeSize is defined so that the 1.0 is the maximum that can fit the given chart rectangle. |
|
450 | The \a relativeSize is defined so that the 1.0 is the maximum that can fit the given chart rectangle. | |
451 |
|
451 | |||
452 | Default value is 0.7. |
|
452 | Default value is 0.7. | |
453 |
|
453 | |||
454 | \sa pieSize(), setPiePosition(), pieVerticalPosition(), pieHorizontalPosition() |
|
454 | \sa pieSize(), setPiePosition(), pieVerticalPosition(), pieHorizontalPosition() | |
455 | */ |
|
455 | */ | |
456 | void QPieSeries::setPieSize(qreal relativeSize) |
|
456 | void QPieSeries::setPieSize(qreal relativeSize) | |
457 | { |
|
457 | { | |
458 | Q_D(QPieSeries); |
|
458 | Q_D(QPieSeries); | |
459 | if (relativeSize < 0.0 || relativeSize > 1.0) |
|
459 | if (relativeSize < 0.0 || relativeSize > 1.0) | |
460 | return; |
|
460 | return; | |
461 |
|
461 | |||
462 | if (!qFuzzyIsNull(d->m_pieRelativeSize- relativeSize)) { |
|
462 | if (!qFuzzyIsNull(d->m_pieRelativeSize- relativeSize)) { | |
463 | d->m_pieRelativeSize = relativeSize; |
|
463 | d->m_pieRelativeSize = relativeSize; | |
464 | emit pieSizeChanged(); |
|
464 | emit pieSizeChanged(); | |
465 | } |
|
465 | } | |
466 | } |
|
466 | } | |
467 |
|
467 | |||
468 | /*! |
|
468 | /*! | |
469 | Gets the relative size of the pie. |
|
469 | Gets the relative size of the pie. | |
470 |
|
470 | |||
471 | The size is defined so that the 1.0 is the maximum that can fit the given chart rectangle. |
|
471 | The size is defined so that the 1.0 is the maximum that can fit the given chart rectangle. | |
472 |
|
472 | |||
473 | Default value is 0.7. |
|
473 | Default value is 0.7. | |
474 |
|
474 | |||
475 | \sa setPieSize(), setPiePosition(), pieVerticalPosition(), pieHorizontalPosition() |
|
475 | \sa setPieSize(), setPiePosition(), pieVerticalPosition(), pieHorizontalPosition() | |
476 | */ |
|
476 | */ | |
477 | qreal QPieSeries::pieSize() const |
|
477 | qreal QPieSeries::pieSize() const | |
478 | { |
|
478 | { | |
479 | Q_D(const QPieSeries); |
|
479 | Q_D(const QPieSeries); | |
480 | return d->m_pieRelativeSize; |
|
480 | return d->m_pieRelativeSize; | |
481 | } |
|
481 | } | |
482 |
|
482 | |||
483 |
|
483 | |||
484 | /*! |
|
484 | /*! | |
485 | Sets the end angle of the pie. |
|
485 | Sets the end angle of the pie. | |
486 |
|
486 | |||
487 | Full pie is 360 degrees where 0 degrees is at 12 a'clock. |
|
487 | Full pie is 360 degrees where 0 degrees is at 12 a'clock. | |
488 |
|
488 | |||
489 | \a angle must be less than pie end angle. Default value is 0. |
|
489 | \a angle must be less than pie end angle. Default value is 0. | |
490 |
|
490 | |||
491 | \sa pieStartAngle(), pieEndAngle(), setPieEndAngle() |
|
491 | \sa pieStartAngle(), pieEndAngle(), setPieEndAngle() | |
492 | */ |
|
492 | */ | |
493 | void QPieSeries::setPieStartAngle(qreal angle) |
|
493 | void QPieSeries::setPieStartAngle(qreal angle) | |
494 | { |
|
494 | { | |
495 | Q_D(QPieSeries); |
|
495 | Q_D(QPieSeries); | |
496 |
|
496 | |||
497 | if (angle < 0 || angle > 360 || angle > d->m_pieEndAngle) |
|
497 | if (angle < 0 || angle > 360 || angle > d->m_pieEndAngle) | |
498 | return; |
|
498 | return; | |
499 |
|
499 | |||
500 | if (!qFuzzyIsNull(angle - d->m_pieStartAngle)) { |
|
500 | if (!qFuzzyIsNull(angle - d->m_pieStartAngle)) { | |
501 | d->m_pieStartAngle = angle; |
|
501 | d->m_pieStartAngle = angle; | |
502 | d->updateDerivativeData(); |
|
502 | d->updateDerivativeData(); | |
503 | } |
|
503 | } | |
504 | } |
|
504 | } | |
505 |
|
505 | |||
506 | /*! |
|
506 | /*! | |
507 | Gets the start angle of the pie. |
|
507 | Gets the start angle of the pie. | |
508 |
|
508 | |||
509 | Full pie is 360 degrees where 0 degrees is at 12 a'clock. Default value is 360. |
|
509 | Full pie is 360 degrees where 0 degrees is at 12 a'clock. Default value is 360. | |
510 |
|
510 | |||
511 | \sa setPieStartAngle(), pieEndAngle(), setPieEndAngle() |
|
511 | \sa setPieStartAngle(), pieEndAngle(), setPieEndAngle() | |
512 | */ |
|
512 | */ | |
513 | qreal QPieSeries::pieStartAngle() const |
|
513 | qreal QPieSeries::pieStartAngle() const | |
514 | { |
|
514 | { | |
515 | Q_D(const QPieSeries); |
|
515 | Q_D(const QPieSeries); | |
516 | return d->m_pieStartAngle; |
|
516 | return d->m_pieStartAngle; | |
517 | } |
|
517 | } | |
518 |
|
518 | |||
519 | /*! |
|
519 | /*! | |
520 | Sets the end angle of the pie. |
|
520 | Sets the end angle of the pie. | |
521 |
|
521 | |||
522 | Full pie is 360 degrees where 0 degrees is at 12 a'clock. |
|
522 | Full pie is 360 degrees where 0 degrees is at 12 a'clock. | |
523 |
|
523 | |||
524 | \a angle must be greater than start angle. |
|
524 | \a angle must be greater than start angle. | |
525 |
|
525 | |||
526 | \sa pieEndAngle(), pieStartAngle(), setPieStartAngle() |
|
526 | \sa pieEndAngle(), pieStartAngle(), setPieStartAngle() | |
527 | */ |
|
527 | */ | |
528 | void QPieSeries::setPieEndAngle(qreal angle) |
|
528 | void QPieSeries::setPieEndAngle(qreal angle) | |
529 | { |
|
529 | { | |
530 | Q_D(QPieSeries); |
|
530 | Q_D(QPieSeries); | |
531 |
|
531 | |||
532 | if (angle < 0 || angle > 360 || angle < d->m_pieStartAngle) |
|
532 | if (angle < 0 || angle > 360 || angle < d->m_pieStartAngle) | |
533 | return; |
|
533 | return; | |
534 |
|
534 | |||
535 | if (!qFuzzyIsNull(angle - d->m_pieEndAngle)) { |
|
535 | if (!qFuzzyIsNull(angle - d->m_pieEndAngle)) { | |
536 | d->m_pieEndAngle = angle; |
|
536 | d->m_pieEndAngle = angle; | |
537 | d->updateDerivativeData(); |
|
537 | d->updateDerivativeData(); | |
538 | } |
|
538 | } | |
539 | } |
|
539 | } | |
540 |
|
540 | |||
541 | /*! |
|
541 | /*! | |
542 | Returns the end angle of the pie. |
|
542 | Returns the end angle of the pie. | |
543 |
|
543 | |||
544 | Full pie is 360 degrees where 0 degrees is at 12 a'clock. |
|
544 | Full pie is 360 degrees where 0 degrees is at 12 a'clock. | |
545 |
|
545 | |||
546 | \sa setPieEndAngle(), pieStartAngle(), setPieStartAngle() |
|
546 | \sa setPieEndAngle(), pieStartAngle(), setPieStartAngle() | |
547 | */ |
|
547 | */ | |
548 | qreal QPieSeries::pieEndAngle() const |
|
548 | qreal QPieSeries::pieEndAngle() const | |
549 | { |
|
549 | { | |
550 | Q_D(const QPieSeries); |
|
550 | Q_D(const QPieSeries); | |
551 | return d->m_pieEndAngle; |
|
551 | return d->m_pieEndAngle; | |
552 | } |
|
552 | } | |
553 |
|
553 | |||
554 | /*! |
|
554 | /*! | |
555 | Sets the all the slice labels \a visible or invisible. |
|
555 | Sets the all the slice labels \a visible or invisible. | |
556 |
|
556 | |||
557 | \sa QPieSlice::isLabelVisible(), QPieSlice::setLabelVisible() |
|
557 | \sa QPieSlice::isLabelVisible(), QPieSlice::setLabelVisible() | |
558 | */ |
|
558 | */ | |
559 | void QPieSeries::setLabelsVisible(bool visible) |
|
559 | void QPieSeries::setLabelsVisible(bool visible) | |
560 | { |
|
560 | { | |
561 | Q_D(QPieSeries); |
|
561 | Q_D(QPieSeries); | |
562 | foreach (QPieSlice* s, d->m_slices) |
|
562 | foreach (QPieSlice* s, d->m_slices) | |
563 | s->setLabelVisible(visible); |
|
563 | s->setLabelVisible(visible); | |
564 | } |
|
564 | } | |
565 |
|
565 | |||
566 | /*! |
|
566 | /*! | |
567 | Returns the sum of all slice values in this series. |
|
567 | Returns the sum of all slice values in this series. | |
568 |
|
568 | |||
569 | \sa QPieSlice::value(), QPieSlice::setValue() |
|
569 | \sa QPieSlice::value(), QPieSlice::setValue() | |
570 | */ |
|
570 | */ | |
571 | qreal QPieSeries::total() const |
|
571 | qreal QPieSeries::total() const | |
572 | { |
|
572 | { | |
573 | Q_D(const QPieSeries); |
|
573 | Q_D(const QPieSeries); | |
574 | return d->m_total; |
|
574 | return d->m_total; | |
575 | } |
|
575 | } | |
576 |
|
576 | |||
577 | /*! |
|
577 | /*! | |
578 | \fn void QPieSeries::clicked(QPieSlice* slice, Qt::MouseButtons buttons) |
|
578 | \fn void QPieSeries::clicked(QPieSlice* slice, Qt::MouseButtons buttons) | |
579 |
|
579 | |||
580 | This signal is emitted when a \a slice has been clicked with mouse \a buttons. |
|
580 | This signal is emitted when a \a slice has been clicked with mouse \a buttons. | |
581 |
|
581 | |||
582 | \sa QPieSlice::clicked() |
|
582 | \sa QPieSlice::clicked() | |
583 | */ |
|
583 | */ | |
584 |
|
584 | |||
585 | /*! |
|
585 | /*! | |
586 | \fn void QPieSeries::hoverEnter(QPieSlice* slice) |
|
586 | \fn void QPieSeries::hoverEnter(QPieSlice* slice) | |
587 |
|
587 | |||
588 | This signal is emitted when user has hovered over a \a slice. |
|
588 | This signal is emitted when user has hovered over a \a slice. | |
589 |
|
589 | |||
590 | \sa QPieSlice::hoverEnter() |
|
590 | \sa QPieSlice::hoverEnter() | |
591 | */ |
|
591 | */ | |
592 |
|
592 | |||
593 | /*! |
|
593 | /*! | |
594 | \fn void QPieSeries::hoverLeave(QPieSlice* slice) |
|
594 | \fn void QPieSeries::hoverLeave(QPieSlice* slice) | |
595 |
|
595 | |||
596 | This signal is emitted when user has hovered away from a \a slice. |
|
596 | This signal is emitted when user has hovered away from a \a slice. | |
597 |
|
597 | |||
598 | \sa QPieSlice::hoverLeave() |
|
598 | \sa QPieSlice::hoverLeave() | |
599 | */ |
|
599 | */ | |
600 |
|
600 | |||
601 | /*! |
|
601 | /*! | |
602 | \fn void QPieSeries::added(QList<QPieSlice*> slices) |
|
602 | \fn void QPieSeries::added(QList<QPieSlice*> slices) | |
603 |
|
603 | |||
604 | This signal is emitted when \a slices has been added to the series. |
|
604 | This signal is emitted when \a slices has been added to the series. | |
605 |
|
605 | |||
606 | \sa append(), insert() |
|
606 | \sa append(), insert() | |
607 | */ |
|
607 | */ | |
608 |
|
608 | |||
609 | /*! |
|
609 | /*! | |
610 | \fn void QPieSeries::removed(QList<QPieSlice*> slices) |
|
610 | \fn void QPieSeries::removed(QList<QPieSlice*> slices) | |
611 |
|
611 | |||
612 | This signal is emitted when \a slices has been removed from the series. |
|
612 | This signal is emitted when \a slices has been removed from the series. | |
613 |
|
613 | |||
614 | \sa remove(), clear() |
|
614 | \sa remove(), clear() | |
615 | */ |
|
615 | */ | |
616 |
|
616 | |||
617 | /*! |
|
617 | /*! | |
618 | \fn void QPieSeries::piePositionChanged() |
|
618 | \fn void QPieSeries::piePositionChanged() | |
619 |
|
619 | |||
620 | This signal is emitted when pie position has changed. |
|
620 | This signal is emitted when pie position has changed. | |
621 |
|
621 | |||
622 | \sa setPiePosition(), pieVerticalPosition(), pieHorizontalPosition() |
|
622 | \sa setPiePosition(), pieVerticalPosition(), pieHorizontalPosition() | |
623 | */ |
|
623 | */ | |
624 |
|
624 | |||
625 | /*! |
|
625 | /*! | |
626 | \fn void QPieSeries::pieSizeChanged() |
|
626 | \fn void QPieSeries::pieSizeChanged() | |
627 |
|
627 | |||
628 | This signal is emitted when pie size has changed. |
|
628 | This signal is emitted when pie size has changed. | |
629 |
|
629 | |||
630 | \sa pieSize(), setPieSize() |
|
630 | \sa pieSize(), setPieSize() | |
631 | */ |
|
631 | */ | |
632 |
|
632 | |||
|
633 | /*! | |||
|
634 | \fn bool QPieSeries::setModel(QAbstractItemModel *model) | |||
|
635 | Sets the \a model to be used as a data source | |||
|
636 | */ | |||
633 | bool QPieSeries::setModel(QAbstractItemModel* model) |
|
637 | bool QPieSeries::setModel(QAbstractItemModel* model) | |
634 | { |
|
638 | { | |
635 | Q_D(QPieSeries); |
|
639 | Q_D(QPieSeries); | |
636 | // disconnect signals from old model |
|
640 | // disconnect signals from old model | |
637 | if(m_model) |
|
641 | if(m_model) | |
638 | { |
|
642 | { | |
639 | disconnect(m_model, 0, this, 0); |
|
643 | disconnect(m_model, 0, this, 0); | |
640 | d->m_mapValues = -1; |
|
644 | d->m_mapValues = -1; | |
641 | d->m_mapLabels = -1; |
|
645 | d->m_mapLabels = -1; | |
642 | d->m_mapOrientation = Qt::Vertical; |
|
646 | d->m_mapOrientation = Qt::Vertical; | |
643 | } |
|
647 | } | |
644 |
|
648 | |||
645 | // set new model |
|
649 | // set new model | |
646 | if(model) |
|
650 | if(model) | |
647 | { |
|
651 | { | |
648 | m_model = model; |
|
652 | m_model = model; | |
649 | return true; |
|
653 | return true; | |
650 | } |
|
654 | } | |
651 | else |
|
655 | else | |
652 | { |
|
656 | { | |
653 | m_model = 0; |
|
657 | m_model = 0; | |
654 | return false; |
|
658 | return false; | |
655 | } |
|
659 | } | |
656 | } |
|
660 | } | |
657 |
|
661 | |||
658 | void QPieSeries::setModelMapping(int modelValuesLine, int modelLabelsLine, Qt::Orientation orientation) |
|
662 | void QPieSeries::setModelMapping(int modelValuesLine, int modelLabelsLine, Qt::Orientation orientation) | |
659 | { |
|
663 | { | |
660 | Q_D(QPieSeries); |
|
664 | Q_D(QPieSeries); | |
661 |
|
665 | |||
662 | if (m_model == 0) |
|
666 | if (m_model == 0) | |
663 | return; |
|
667 | return; | |
664 |
|
668 | |||
665 | d->m_mapValues = modelValuesLine; |
|
669 | d->m_mapValues = modelValuesLine; | |
666 | d->m_mapLabels = modelLabelsLine; |
|
670 | d->m_mapLabels = modelLabelsLine; | |
667 | d->m_mapOrientation = orientation; |
|
671 | d->m_mapOrientation = orientation; | |
668 |
|
672 | |||
669 | // connect the signals |
|
673 | // connect the signals | |
670 | if (d->m_mapOrientation == Qt::Vertical) { |
|
674 | if (d->m_mapOrientation == Qt::Vertical) { | |
671 | connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex, QModelIndex))); |
|
675 | connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex, QModelIndex))); | |
672 | connect(m_model, SIGNAL(rowsInserted(QModelIndex, int, int)), d, SLOT(modelDataAdded(QModelIndex,int,int))); |
|
676 | connect(m_model, SIGNAL(rowsInserted(QModelIndex, int, int)), d, SLOT(modelDataAdded(QModelIndex,int,int))); | |
673 | connect(m_model, SIGNAL(rowsRemoved(QModelIndex, int, int)), d, SLOT(modelDataRemoved(QModelIndex,int,int))); |
|
677 | connect(m_model, SIGNAL(rowsRemoved(QModelIndex, int, int)), d, SLOT(modelDataRemoved(QModelIndex,int,int))); | |
674 | } else { |
|
678 | } else { | |
675 | connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex, QModelIndex))); |
|
679 | connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex, QModelIndex))); | |
676 | connect(m_model, SIGNAL(columnsInserted(QModelIndex, int, int)), d, SLOT(modelDataAdded(QModelIndex,int,int))); |
|
680 | connect(m_model, SIGNAL(columnsInserted(QModelIndex, int, int)), d, SLOT(modelDataAdded(QModelIndex,int,int))); | |
677 | connect(m_model, SIGNAL(columnsRemoved(QModelIndex, int, int)), d, SLOT(modelDataRemoved(QModelIndex,int,int))); |
|
681 | connect(m_model, SIGNAL(columnsRemoved(QModelIndex, int, int)), d, SLOT(modelDataRemoved(QModelIndex,int,int))); | |
678 | } |
|
682 | } | |
679 |
|
683 | |||
680 | // create the initial slices set |
|
684 | // create the initial slices set | |
681 | if (d->m_mapOrientation == Qt::Vertical) { |
|
685 | if (d->m_mapOrientation == Qt::Vertical) { | |
682 | for (int i = 0; i < m_model->rowCount(); i++) |
|
686 | for (int i = 0; i < m_model->rowCount(); i++) | |
683 | append(m_model->data(m_model->index(i, d->m_mapValues), Qt::DisplayRole).toDouble(), m_model->data(m_model->index(i, d->m_mapLabels), Qt::DisplayRole).toString()); |
|
687 | append(m_model->data(m_model->index(i, d->m_mapValues), Qt::DisplayRole).toDouble(), m_model->data(m_model->index(i, d->m_mapLabels), Qt::DisplayRole).toString()); | |
684 | } else { |
|
688 | } else { | |
685 | for (int i = 0; i < m_model->columnCount(); i++) |
|
689 | for (int i = 0; i < m_model->columnCount(); i++) | |
686 | append(m_model->data(m_model->index(d->m_mapValues, i), Qt::DisplayRole).toDouble(), m_model->data(m_model->index(d->m_mapLabels, i), Qt::DisplayRole).toString()); |
|
690 | append(m_model->data(m_model->index(d->m_mapValues, i), Qt::DisplayRole).toDouble(), m_model->data(m_model->index(d->m_mapLabels, i), Qt::DisplayRole).toString()); | |
687 | } |
|
691 | } | |
688 | } |
|
692 | } | |
689 |
|
693 | |||
690 | #include "moc_qpieseries.cpp" |
|
694 | #include "moc_qpieseries.cpp" | |
691 | #include "moc_qpieseriesprivate_p.cpp" |
|
695 | #include "moc_qpieseriesprivate_p.cpp" | |
692 |
|
696 | |||
693 | QTCOMMERCIALCHART_END_NAMESPACE |
|
697 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,69 +1,70 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef QSERIES_H |
|
21 | #ifndef QSERIES_H | |
22 | #define QSERIES_H |
|
22 | #define QSERIES_H | |
23 |
|
23 | |||
24 | #include <qchartglobal.h> |
|
24 | #include <qchartglobal.h> | |
25 | #include <QObject> |
|
25 | #include <QObject> | |
26 | //#include <QAbstractItemModel> |
|
26 | //#include <QAbstractItemModel> | |
27 | #include <QPen> |
|
27 | #include <QPen> | |
28 |
|
28 | |||
29 | class QAbstractItemModel; |
|
29 | class QAbstractItemModel; | |
30 |
|
30 | |||
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
32 |
|
32 | |||
33 | class QTCOMMERCIALCHART_EXPORT QSeries : public QObject |
|
33 | class QTCOMMERCIALCHART_EXPORT QSeries : public QObject | |
34 | { |
|
34 | { | |
35 | Q_OBJECT |
|
35 | Q_OBJECT | |
36 | public: |
|
36 | public: | |
37 | enum QSeriesType { |
|
37 | enum QSeriesType { | |
38 | SeriesTypeLine, |
|
38 | SeriesTypeLine, | |
39 | SeriesTypeArea, |
|
39 | SeriesTypeArea, | |
40 | SeriesTypeBar, |
|
40 | SeriesTypeBar, | |
41 | SeriesTypeStackedBar, |
|
41 | SeriesTypeStackedBar, | |
42 | SeriesTypePercentBar, |
|
42 | SeriesTypePercentBar, | |
43 | SeriesTypePie, |
|
43 | SeriesTypePie, | |
44 | SeriesTypeScatter, |
|
44 | SeriesTypeScatter, | |
45 | SeriesTypeSpline |
|
45 | SeriesTypeSpline | |
46 | }; |
|
46 | }; | |
47 |
|
47 | |||
48 | protected: |
|
48 | protected: | |
49 | QSeries(QObject *parent = 0) : QObject(parent) {m_model = 0;} |
|
49 | QSeries(QObject *parent = 0) : QObject(parent) {m_model = 0;} | |
50 |
|
50 | |||
51 | public: |
|
51 | public: | |
52 | virtual ~QSeries() {} |
|
52 | virtual ~QSeries() {} | |
53 | virtual QSeriesType type() const = 0; |
|
53 | virtual QSeriesType type() const = 0; | |
54 | // TODO |
|
54 | // TODO | |
55 | virtual bool setModel(QAbstractItemModel* /*model*/) { return false; } |
|
55 | virtual bool setModel(QAbstractItemModel* /*model*/) { return false; } | |
56 | QAbstractItemModel* model() const { return m_model; } |
|
56 | QAbstractItemModel* model() const { return m_model; } | |
|
57 | ||||
57 | void setName(QString name) { m_name = name; } |
|
58 | void setName(QString name) { m_name = name; } | |
58 | QString name() const { return m_name; } |
|
59 | QString name() const { return m_name; } | |
59 |
|
60 | |||
60 | protected: |
|
61 | protected: | |
61 | QAbstractItemModel* m_model; |
|
62 | QAbstractItemModel* m_model; | |
62 |
|
63 | |||
63 | private: |
|
64 | private: | |
64 | QString m_name; |
|
65 | QString m_name; | |
65 | }; |
|
66 | }; | |
66 |
|
67 | |||
67 | QTCOMMERCIALCHART_END_NAMESPACE |
|
68 | QTCOMMERCIALCHART_END_NAMESPACE | |
68 |
|
69 | |||
69 | #endif |
|
70 | #endif |
@@ -1,104 +1,103 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef QXYSERIES_H_ |
|
21 | #ifndef QXYSERIES_H_ | |
22 | #define QXYSERIES_H_ |
|
22 | #define QXYSERIES_H_ | |
23 |
|
23 | |||
24 | #include <qchartglobal.h> |
|
24 | #include <qchartglobal.h> | |
25 | #include <qseries.h> |
|
25 | #include <qseries.h> | |
26 | #include <QPen> |
|
26 | #include <QPen> | |
27 | #include <QBrush> |
|
27 | #include <QBrush> | |
28 |
|
28 | |||
29 | class QModelIndex; |
|
29 | class QModelIndex; | |
30 |
|
30 | |||
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
32 |
|
32 | |||
33 | class QTCOMMERCIALCHART_EXPORT QXYSeries : public QSeries |
|
33 | class QTCOMMERCIALCHART_EXPORT QXYSeries : public QSeries | |
34 | { |
|
34 | { | |
35 | Q_OBJECT |
|
35 | Q_OBJECT | |
36 | protected: |
|
36 | protected: | |
37 | QXYSeries(QObject *parent = 0); |
|
37 | QXYSeries(QObject *parent = 0); | |
38 | virtual ~QXYSeries(); |
|
38 | virtual ~QXYSeries(); | |
39 |
|
39 | |||
40 | public: |
|
40 | public: | |
41 | void append(qreal x, qreal y); |
|
41 | void append(qreal x, qreal y); | |
42 | void append(const QPointF &point); |
|
42 | void append(const QPointF &point); | |
43 | void append(const QList<QPointF> points); |
|
43 | void append(const QList<QPointF> points); | |
44 | void replace(qreal x,qreal y); |
|
44 | void replace(qreal x,qreal y); | |
45 | void replace(const QPointF &point); |
|
45 | void replace(const QPointF &point); | |
46 | void remove(qreal x); |
|
46 | void remove(qreal x); | |
47 | void remove(qreal x, qreal y); |
|
47 | void remove(qreal x, qreal y); | |
48 | void remove(const QPointF &point); |
|
48 | void remove(const QPointF &point); | |
49 | void removeAll(); |
|
49 | void removeAll(); | |
50 |
|
50 | |||
51 | int count() const; |
|
51 | int count() const; | |
52 | qreal x(int pos) const; |
|
52 | qreal x(int pos) const; | |
53 | qreal y(int pos) const; |
|
53 | qreal y(int pos) const; | |
54 | QList<QPointF> data(); |
|
54 | QList<QPointF> data(); | |
55 |
|
55 | |||
56 | QXYSeries& operator << (const QPointF &point); |
|
56 | QXYSeries& operator << (const QPointF &point); | |
57 | QXYSeries& operator << (const QList<QPointF> points); |
|
57 | QXYSeries& operator << (const QList<QPointF> points); | |
58 |
|
58 | |||
59 | void setPen(const QPen &pen); |
|
59 | void setPen(const QPen &pen); | |
60 | QPen pen() const {return m_pen;} |
|
60 | QPen pen() const {return m_pen;} | |
61 | void setBrush(const QBrush &brush); |
|
61 | void setBrush(const QBrush &brush); | |
62 | QBrush brush() const {return m_brush;} |
|
62 | QBrush brush() const {return m_brush;} | |
63 |
|
63 | |||
64 | bool setModel(QAbstractItemModel *model); |
|
64 | bool setModel(QAbstractItemModel *model); | |
65 | // QAbstractItemModel* model() const { return m_model; } |
|
|||
66 |
|
65 | |||
67 | virtual void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical); |
|
66 | virtual void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical); | |
68 | virtual void setModelMappingRange(int first, int count = 0); |
|
67 | virtual void setModelMappingRange(int first, int count = 0); | |
69 | int mapFirst() const { return m_mapFirst; } |
|
68 | int mapFirst() const { return m_mapFirst; } | |
70 |
|
69 | |||
71 | private Q_SLOTS: |
|
70 | private Q_SLOTS: | |
72 | void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight); |
|
71 | void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight); | |
73 | void modelDataAboutToBeAdded(QModelIndex parent, int start, int end); |
|
72 | void modelDataAboutToBeAdded(QModelIndex parent, int start, int end); | |
74 | void modelDataAdded(QModelIndex parent, int start, int end); |
|
73 | void modelDataAdded(QModelIndex parent, int start, int end); | |
75 | void modelDataAboutToBeRemoved(QModelIndex parent, int start, int end); |
|
74 | void modelDataAboutToBeRemoved(QModelIndex parent, int start, int end); | |
76 | void modelDataRemoved(QModelIndex parent, int start, int end); |
|
75 | void modelDataRemoved(QModelIndex parent, int start, int end); | |
77 |
|
76 | |||
78 | Q_SIGNALS: |
|
77 | Q_SIGNALS: | |
79 | void clicked(const QPointF &point); |
|
78 | void clicked(const QPointF &point); | |
80 | void selected(); |
|
79 | void selected(); | |
81 | void updated(); |
|
80 | void updated(); | |
82 | void pointReplaced(int index); |
|
81 | void pointReplaced(int index); | |
83 | void pointRemoved(int index); |
|
82 | void pointRemoved(int index); | |
84 | void pointAdded(int index); |
|
83 | void pointAdded(int index); | |
85 |
|
84 | |||
86 | protected: |
|
85 | protected: | |
87 | QVector<qreal> m_x; |
|
86 | QVector<qreal> m_x; | |
88 | QVector<qreal> m_y; |
|
87 | QVector<qreal> m_y; | |
89 |
|
88 | |||
90 | QPen m_pen; |
|
89 | QPen m_pen; | |
91 | QBrush m_brush; |
|
90 | QBrush m_brush; | |
92 |
|
91 | |||
93 | int m_mapX; |
|
92 | int m_mapX; | |
94 | int m_mapY; |
|
93 | int m_mapY; | |
95 | int m_mapFirst; |
|
94 | int m_mapFirst; | |
96 | int m_mapCount; |
|
95 | int m_mapCount; | |
97 | bool m_mapLimited; |
|
96 | bool m_mapLimited; | |
98 | Qt::Orientation m_mapOrientation; |
|
97 | Qt::Orientation m_mapOrientation; | |
99 | int tempItemsRemoved; |
|
98 | int tempItemsRemoved; | |
100 | }; |
|
99 | }; | |
101 |
|
100 | |||
102 | QTCOMMERCIALCHART_END_NAMESPACE |
|
101 | QTCOMMERCIALCHART_END_NAMESPACE | |
103 |
|
102 | |||
104 | #endif |
|
103 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now