##// END OF EJS Templates
declarative series for horizontal barcharts
sauimone -
r1806:e1166aadc392
parent child
Show More
@@ -1,232 +1,406
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "declarativebarseries.h"
22 22 #include <QBarSet>
23 23 #include <QVBarModelMapper>
24 24 #include <QHBarModelMapper>
25 25
26 26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27 27
28 28 DeclarativeBarSet::DeclarativeBarSet(QObject *parent) :
29 29 QBarSet("", parent)
30 30 {
31 31 connect(this, SIGNAL(valuesAdded(int,int)), this, SLOT(handleCountChanged(int, int)));
32 32 connect(this, SIGNAL(valuesRemoved(int,int)), this, SLOT(handleCountChanged(int, int)));
33 33 }
34 34
35 35 void DeclarativeBarSet::handleCountChanged(int index, int count)
36 36 {
37 37 Q_UNUSED(index)
38 38 Q_UNUSED(count)
39 39 emit countChanged(QBarSet::count());
40 40 }
41 41
42 42 QVariantList DeclarativeBarSet::values()
43 43 {
44 44 QVariantList values;
45 45 for (int i(0); i < count(); i++)
46 46 values.append(QVariant(QBarSet::at(i)));
47 47 return values;
48 48 }
49 49
50 50 void DeclarativeBarSet::setValues(QVariantList values)
51 51 {
52 52 while (count())
53 53 remove(count() - 1);
54 54
55 55 for (int i(0); i < values.count(); i++) {
56 56 if (values.at(i).canConvert(QVariant::Double))
57 57 QBarSet::append(values[i].toDouble());
58 58 }
59 59 }
60 60
61 // Declarative bar series ======================================================================================
61 62 DeclarativeBarSeries::DeclarativeBarSeries(QDeclarativeItem *parent) :
62 63 QBarSeries(parent)
63 64 {
64 65 }
65 66
66 67 void DeclarativeBarSeries::classBegin()
67 68 {
68 69 }
69 70
70 71 void DeclarativeBarSeries::componentComplete()
71 72 {
72 73 foreach(QObject *child, children()) {
73 74 if (qobject_cast<DeclarativeBarSet *>(child)) {
74 75 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
75 76 } else if(qobject_cast<QVBarModelMapper *>(child)) {
76 77 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
77 78 mapper->setSeries(this);
78 79 } else if(qobject_cast<QHBarModelMapper *>(child)) {
79 80 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
80 81 mapper->setSeries(this);
81 82 }
82 83 }
83 84 }
84 85
85 86 QDeclarativeListProperty<QObject> DeclarativeBarSeries::seriesChildren()
86 87 {
87 88 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren);
88 89 }
89 90
90 91 void DeclarativeBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
91 92 {
92 93 // Empty implementation; the children are parsed in componentComplete instead
93 94 Q_UNUSED(list);
94 95 Q_UNUSED(element);
95 96 }
96 97
97 98 DeclarativeBarSet *DeclarativeBarSeries::at(int index)
98 99 {
99 100 QList<QBarSet*> setList = barSets();
100 101 if (index >= 0 && index < setList.count())
101 102 return qobject_cast<DeclarativeBarSet *>(setList[index]);
102 103
103 104 return 0;
104 105 }
105 106
106 107 DeclarativeBarSet *DeclarativeBarSeries::insert(int index, QString label, QVariantList values)
107 108 {
108 109 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
109 110 barset->setLabel(label);
110 111 barset->setValues(values);
111 112 if (QBarSeries::insert(index, barset))
112 113 return barset;
113 114 delete barset;
114 115 return 0;
115 116 }
116 117
118 // Declarative stacked bar series ==============================================================================
117 119 DeclarativeStackedBarSeries::DeclarativeStackedBarSeries(QDeclarativeItem *parent) :
118 120 QStackedBarSeries(parent)
119 121 {
120 122 }
121 123
122 124 void DeclarativeStackedBarSeries::classBegin()
123 125 {
124 126 }
125 127
126 128 void DeclarativeStackedBarSeries::componentComplete()
127 129 {
128 130 foreach(QObject *child, children()) {
129 131 if (qobject_cast<DeclarativeBarSet *>(child)) {
130 132 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
131 133 } else if(qobject_cast<QVBarModelMapper *>(child)) {
132 134 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
133 135 mapper->setSeries(this);
134 136 } else if(qobject_cast<QHBarModelMapper *>(child)) {
135 137 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
136 138 mapper->setSeries(this);
137 139 }
138 140 }
139 141 }
140 142
141 143
142 144 QDeclarativeListProperty<QObject> DeclarativeStackedBarSeries::seriesChildren()
143 145 {
144 146 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren);
145 147 }
146 148
147 149 void DeclarativeStackedBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
148 150 {
149 151 // Empty implementation; the children are parsed in componentComplete instead
150 152 Q_UNUSED(list);
151 153 Q_UNUSED(element);
152 154 }
153 155
154 156 DeclarativeBarSet *DeclarativeStackedBarSeries::at(int index)
155 157 {
156 158 QList<QBarSet*> setList = barSets();
157 159 if (index >= 0 && index < setList.count())
158 160 return qobject_cast<DeclarativeBarSet *>(setList[index]);
159 161
160 162 return 0;
161 163 }
162 164
163 165 DeclarativeBarSet *DeclarativeStackedBarSeries::insert(int index, QString label, QVariantList values)
164 166 {
165 167 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
166 168 barset->setLabel(label);
167 169 barset->setValues(values);
168 170 if (QStackedBarSeries::insert(index, barset))
169 171 return barset;
170 172 delete barset;
171 173 return 0;
172 174 }
173 175
176 // Declarative percent bar series ==============================================================================
174 177 DeclarativePercentBarSeries::DeclarativePercentBarSeries(QDeclarativeItem *parent) :
175 178 QPercentBarSeries(parent)
176 179 {
177 180 }
178 181
179 182 void DeclarativePercentBarSeries::classBegin()
180 183 {
181 184 }
182 185
183 186 void DeclarativePercentBarSeries::componentComplete()
184 187 {
185 188 foreach(QObject *child, children()) {
186 189 if (qobject_cast<DeclarativeBarSet *>(child)) {
187 190 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
188 191 } else if(qobject_cast<QVBarModelMapper *>(child)) {
189 192 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
190 193 mapper->setSeries(this);
191 194 } else if(qobject_cast<QHBarModelMapper *>(child)) {
192 195 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
193 196 mapper->setSeries(this);
194 197 }
195 198 }
196 199 }
197 200
198 201 QDeclarativeListProperty<QObject> DeclarativePercentBarSeries::seriesChildren()
199 202 {
200 203 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren);
201 204 }
202 205
203 206 void DeclarativePercentBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
204 207 {
205 208 // Empty implementation; the children are parsed in componentComplete instead
206 209 Q_UNUSED(list);
207 210 Q_UNUSED(element);
208 211 }
209 212
210 213 DeclarativeBarSet *DeclarativePercentBarSeries::at(int index)
211 214 {
212 215 QList<QBarSet*> setList = barSets();
213 216 if (index >= 0 && index < setList.count())
214 217 return qobject_cast<DeclarativeBarSet *>(setList[index]);
215 218
216 219 return 0;
217 220 }
218 221
219 222 DeclarativeBarSet *DeclarativePercentBarSeries::insert(int index, QString label, QVariantList values)
220 223 {
221 224 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
222 225 barset->setLabel(label);
223 226 barset->setValues(values);
224 227 if (QPercentBarSeries::insert(index, barset))
225 228 return barset;
226 229 delete barset;
227 230 return 0;
228 231 }
229 232
233 // Declarative horizontal bar series ===========================================================================
234 DeclarativeHorizontalBarSeries::DeclarativeHorizontalBarSeries(QDeclarativeItem *parent) :
235 QHorizontalBarSeries(parent)
236 {
237 }
238
239 void DeclarativeHorizontalBarSeries::classBegin()
240 {
241 }
242
243 void DeclarativeHorizontalBarSeries::componentComplete()
244 {
245 foreach(QObject *child, children()) {
246 if (qobject_cast<DeclarativeBarSet *>(child)) {
247 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
248 } else if(qobject_cast<QVBarModelMapper *>(child)) {
249 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
250 mapper->setSeries(this);
251 } else if(qobject_cast<QHBarModelMapper *>(child)) {
252 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
253 mapper->setSeries(this);
254 }
255 }
256 }
257
258 QDeclarativeListProperty<QObject> DeclarativeHorizontalBarSeries::seriesChildren()
259 {
260 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeHorizontalBarSeries::appendSeriesChildren);
261 }
262
263 void DeclarativeHorizontalBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
264 {
265 // Empty implementation; the children are parsed in componentComplete instead
266 Q_UNUSED(list);
267 Q_UNUSED(element);
268 }
269
270 DeclarativeBarSet *DeclarativeHorizontalBarSeries::at(int index)
271 {
272 QList<QBarSet*> setList = barSets();
273 if (index >= 0 && index < setList.count())
274 return qobject_cast<DeclarativeBarSet *>(setList[index]);
275
276 return 0;
277 }
278
279 DeclarativeBarSet *DeclarativeHorizontalBarSeries::insert(int index, QString label, QVariantList values)
280 {
281 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
282 barset->setLabel(label);
283 barset->setValues(values);
284 if (QHorizontalBarSeries::insert(index, barset))
285 return barset;
286 delete barset;
287 return 0;
288 }
289
290 // Declarative horizontal stacked bar series ===================================================================
291 DeclarativeHorizontalStackedBarSeries::DeclarativeHorizontalStackedBarSeries(QDeclarativeItem *parent) :
292 QHorizontalStackedBarSeries(parent)
293 {
294 }
295
296 void DeclarativeHorizontalStackedBarSeries::classBegin()
297 {
298 }
299
300 void DeclarativeHorizontalStackedBarSeries::componentComplete()
301 {
302 foreach(QObject *child, children()) {
303 if (qobject_cast<DeclarativeBarSet *>(child)) {
304 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
305 } else if(qobject_cast<QVBarModelMapper *>(child)) {
306 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
307 mapper->setSeries(this);
308 } else if(qobject_cast<QHBarModelMapper *>(child)) {
309 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
310 mapper->setSeries(this);
311 }
312 }
313 }
314
315 QDeclarativeListProperty<QObject> DeclarativeHorizontalStackedBarSeries::seriesChildren()
316 {
317 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeHorizontalStackedBarSeries::appendSeriesChildren);
318 }
319
320 void DeclarativeHorizontalStackedBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
321 {
322 // Empty implementation; the children are parsed in componentComplete instead
323 Q_UNUSED(list);
324 Q_UNUSED(element);
325 }
326
327 DeclarativeBarSet *DeclarativeHorizontalStackedBarSeries::at(int index)
328 {
329 QList<QBarSet*> setList = barSets();
330 if (index >= 0 && index < setList.count())
331 return qobject_cast<DeclarativeBarSet *>(setList[index]);
332
333 return 0;
334 }
335
336 DeclarativeBarSet *DeclarativeHorizontalStackedBarSeries::insert(int index, QString label, QVariantList values)
337 {
338 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
339 barset->setLabel(label);
340 barset->setValues(values);
341 if (QHorizontalStackedBarSeries::insert(index, barset))
342 return barset;
343 delete barset;
344 return 0;
345 }
346
347 // Declarative horizontal percent bar series ===================================================================
348 DeclarativeHorizontalPercentBarSeries::DeclarativeHorizontalPercentBarSeries(QDeclarativeItem *parent) :
349 QHorizontalPercentBarSeries(parent)
350 {
351 }
352
353 void DeclarativeHorizontalPercentBarSeries::classBegin()
354 {
355 }
356
357 void DeclarativeHorizontalPercentBarSeries::componentComplete()
358 {
359 foreach(QObject *child, children()) {
360 if (qobject_cast<DeclarativeBarSet *>(child)) {
361 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
362 } else if(qobject_cast<QVBarModelMapper *>(child)) {
363 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
364 mapper->setSeries(this);
365 } else if(qobject_cast<QHBarModelMapper *>(child)) {
366 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
367 mapper->setSeries(this);
368 }
369 }
370 }
371
372 QDeclarativeListProperty<QObject> DeclarativeHorizontalPercentBarSeries::seriesChildren()
373 {
374 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeHorizontalPercentBarSeries::appendSeriesChildren);
375 }
376
377 void DeclarativeHorizontalPercentBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
378 {
379 // Empty implementation; the children are parsed in componentComplete instead
380 Q_UNUSED(list);
381 Q_UNUSED(element);
382 }
383
384 DeclarativeBarSet *DeclarativeHorizontalPercentBarSeries::at(int index)
385 {
386 QList<QBarSet*> setList = barSets();
387 if (index >= 0 && index < setList.count())
388 return qobject_cast<DeclarativeBarSet *>(setList[index]);
389
390 return 0;
391 }
392
393 DeclarativeBarSet *DeclarativeHorizontalPercentBarSeries::insert(int index, QString label, QVariantList values)
394 {
395 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
396 barset->setLabel(label);
397 barset->setValues(values);
398 if (QHorizontalPercentBarSeries::insert(index, barset))
399 return barset;
400 delete barset;
401 return 0;
402 }
403
230 404 #include "moc_declarativebarseries.cpp"
231 405
232 406 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,138 +1,213
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #ifndef DECLARATIVEBARSERIES_H
22 22 #define DECLARATIVEBARSERIES_H
23 23
24 24 #include "qbarseries.h"
25 25 #include "qstackedbarseries.h"
26 26 #include "qpercentbarseries.h"
27 #include "qhorizontalbarseries.h"
28 #include "qhorizontalstackedbarseries.h"
29 #include "qhorizontalpercentbarseries.h"
27 30 #include "qbarset.h"
28 31 #include <QDeclarativeItem>
29 32 #include <QDeclarativeParserStatus>
30 33
31 34 QTCOMMERCIALCHART_BEGIN_NAMESPACE
32 35
33 36 class QChart;
34 37
35 38 class DeclarativeBarSet : public QBarSet
36 39 {
37 40 Q_OBJECT
38 41 Q_PROPERTY(QVariantList values READ values WRITE setValues)
39 42 Q_PROPERTY(int count READ count NOTIFY countChanged)
40 43
41 44 public:
42 45 explicit DeclarativeBarSet(QObject *parent = 0);
43 46 QVariantList values();
44 47 void setValues(QVariantList values);
45 48
46 49 public: // From QBarSet
47 50 Q_INVOKABLE void append(qreal value) { QBarSet::append(value); }
48 51 Q_INVOKABLE void remove(const int index, const int count = 1) { QBarSet::remove(index, count); }
49 52 Q_INVOKABLE void replace(int index, qreal value) { QBarSet::replace(index, value); }
50 53 Q_INVOKABLE qreal at(int index) { return QBarSet::at(index); }
51 54
52 55 Q_SIGNALS:
53 56 void countChanged(int count);
54 57
55 58 private Q_SLOTS:
56 59 void handleCountChanged(int index, int count);
57 60 };
58 61
59 62 class DeclarativeBarSeries : public QBarSeries, public QDeclarativeParserStatus
60 63 {
61 64 Q_OBJECT
62 65 Q_INTERFACES(QDeclarativeParserStatus)
63 66 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
64 67 Q_CLASSINFO("DefaultProperty", "seriesChildren")
65 68
66 69 public:
67 70 explicit DeclarativeBarSeries(QDeclarativeItem *parent = 0);
68 71 QDeclarativeListProperty<QObject> seriesChildren();
69 72 Q_INVOKABLE DeclarativeBarSet *at(int index);
70 73 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
71 74 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
72 75 Q_INVOKABLE bool remove(QBarSet *barset) { return QBarSeries::remove(barset); }
73 76 Q_INVOKABLE void clear() { return QBarSeries::clear(); }
74 77
75 78 public: // from QDeclarativeParserStatus
76 79 void classBegin();
77 80 void componentComplete();
78 81
79 82 public Q_SLOTS:
80 83 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
81 84
82 85 private:
83 86 QAbstractAxis* m_axisX;
84 87 QAbstractAxis* m_axisY;
85 88 };
86 89
87 90 class DeclarativeStackedBarSeries : public QStackedBarSeries, public QDeclarativeParserStatus
88 91 {
89 92 Q_OBJECT
90 93 Q_INTERFACES(QDeclarativeParserStatus)
91 94 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
92 95 Q_CLASSINFO("DefaultProperty", "seriesChildren")
93 96
94 97 public:
95 98 explicit DeclarativeStackedBarSeries(QDeclarativeItem *parent = 0);
96 99 QDeclarativeListProperty<QObject> seriesChildren();
97 100 Q_INVOKABLE DeclarativeBarSet *at(int index);
98 101 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
99 102 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
100 103 Q_INVOKABLE bool remove(QBarSet *barset) { return QStackedBarSeries::remove(barset); }
101 104 Q_INVOKABLE void clear() { return QStackedBarSeries::clear(); }
102 105
103 106 public: // from QDeclarativeParserStatus
104 107 void classBegin();
105 108 void componentComplete();
106 109
107 110 public Q_SLOTS:
108 111 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
109 112
110 113 };
111 114
112 115 class DeclarativePercentBarSeries : public QPercentBarSeries, public QDeclarativeParserStatus
113 116 {
114 117 Q_OBJECT
115 118 Q_INTERFACES(QDeclarativeParserStatus)
116 119 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
117 120 Q_CLASSINFO("DefaultProperty", "seriesChildren")
118 121
119 122 public:
120 123 explicit DeclarativePercentBarSeries(QDeclarativeItem *parent = 0);
121 124 QDeclarativeListProperty<QObject> seriesChildren();
122 125 Q_INVOKABLE DeclarativeBarSet *at(int index);
123 126 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
124 127 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
125 128 Q_INVOKABLE bool remove(QBarSet *barset) { return QPercentBarSeries::remove(barset); }
126 129 Q_INVOKABLE void clear() { return QPercentBarSeries::clear(); }
127 130
128 131 public: // from QDeclarativeParserStatus
129 132 void classBegin();
130 133 void componentComplete();
131 134
132 135 public Q_SLOTS:
133 136 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
134 137 };
135 138
139 class DeclarativeHorizontalBarSeries : public QHorizontalBarSeries, public QDeclarativeParserStatus
140 {
141 Q_OBJECT
142 Q_INTERFACES(QDeclarativeParserStatus)
143 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
144 Q_CLASSINFO("DefaultProperty", "seriesChildren")
145
146 public:
147 explicit DeclarativeHorizontalBarSeries(QDeclarativeItem *parent = 0);
148 QDeclarativeListProperty<QObject> seriesChildren();
149 Q_INVOKABLE DeclarativeBarSet *at(int index);
150 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
151 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
152 Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalBarSeries::remove(barset); }
153 Q_INVOKABLE void clear() { return QHorizontalBarSeries::clear(); }
154
155 public: // from QDeclarativeParserStatus
156 void classBegin();
157 void componentComplete();
158
159 public Q_SLOTS:
160 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
161 };
162
163 class DeclarativeHorizontalStackedBarSeries : public QHorizontalStackedBarSeries, public QDeclarativeParserStatus
164 {
165 Q_OBJECT
166 Q_INTERFACES(QDeclarativeParserStatus)
167 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
168 Q_CLASSINFO("DefaultProperty", "seriesChildren")
169
170 public:
171 explicit DeclarativeHorizontalStackedBarSeries(QDeclarativeItem *parent = 0);
172 QDeclarativeListProperty<QObject> seriesChildren();
173 Q_INVOKABLE DeclarativeBarSet *at(int index);
174 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
175 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
176 Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalStackedBarSeries::remove(barset); }
177 Q_INVOKABLE void clear() { return QHorizontalStackedBarSeries::clear(); }
178
179 public: // from QDeclarativeParserStatus
180 void classBegin();
181 void componentComplete();
182
183 public Q_SLOTS:
184 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
185 };
186
187 class DeclarativeHorizontalPercentBarSeries : public QHorizontalPercentBarSeries, public QDeclarativeParserStatus
188 {
189 Q_OBJECT
190 Q_INTERFACES(QDeclarativeParserStatus)
191 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
192 Q_CLASSINFO("DefaultProperty", "seriesChildren")
193
194 public:
195 explicit DeclarativeHorizontalPercentBarSeries(QDeclarativeItem *parent = 0);
196 QDeclarativeListProperty<QObject> seriesChildren();
197 Q_INVOKABLE DeclarativeBarSet *at(int index);
198 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
199 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
200 Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalPercentBarSeries::remove(barset); }
201 Q_INVOKABLE void clear() { return QHorizontalPercentBarSeries::clear(); }
202
203 public: // from QDeclarativeParserStatus
204 void classBegin();
205 void componentComplete();
206
207 public Q_SLOTS:
208 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
209 };
210
136 211 QTCOMMERCIALCHART_END_NAMESPACE
137 212
138 213 #endif // DECLARATIVEBARSERIES_H
General Comments 0
You need to be logged in to leave comments. Login now