##// END OF EJS Templates
removed many unnecessary includes from declarative files
Marek Rosa -
r1669:c1e1d8755203
parent child
Show More
@@ -1,56 +1,53
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 "declarativeareaseries.h"
21 #include "declarativeareaseries.h"
22 #include "declarativechart.h"
23 #include "qchart.h"
24 #include "qxymodelmapper.h"
25
22
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
23 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27
24
28 DeclarativeAreaSeries::DeclarativeAreaSeries(QObject *parent) :
25 DeclarativeAreaSeries::DeclarativeAreaSeries(QObject *parent) :
29 QAreaSeries(parent)
26 QAreaSeries(parent)
30 {
27 {
31 }
28 }
32
29
33
30
34 void DeclarativeAreaSeries::setUpperSeries(DeclarativeLineSeries* series)
31 void DeclarativeAreaSeries::setUpperSeries(DeclarativeLineSeries* series)
35 {
32 {
36 QAreaSeries::setUpperSeries(series);
33 QAreaSeries::setUpperSeries(series);
37 }
34 }
38
35
39 DeclarativeLineSeries* DeclarativeAreaSeries::upperSeries() const
36 DeclarativeLineSeries* DeclarativeAreaSeries::upperSeries() const
40 {
37 {
41 return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::upperSeries());
38 return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::upperSeries());
42 }
39 }
43
40
44 void DeclarativeAreaSeries::setLowerSeries(DeclarativeLineSeries* series)
41 void DeclarativeAreaSeries::setLowerSeries(DeclarativeLineSeries* series)
45 {
42 {
46 QAreaSeries::setLowerSeries(series);
43 QAreaSeries::setLowerSeries(series);
47 }
44 }
48
45
49 DeclarativeLineSeries* DeclarativeAreaSeries::lowerSeries() const
46 DeclarativeLineSeries* DeclarativeAreaSeries::lowerSeries() const
50 {
47 {
51 return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::lowerSeries());
48 return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::lowerSeries());
52 }
49 }
53
50
54 #include "moc_declarativeareaseries.cpp"
51 #include "moc_declarativeareaseries.cpp"
55
52
56 QTCOMMERCIALCHART_END_NAMESPACE
53 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,47 +1,45
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 DECLARATIVEAREASERIES_H
21 #ifndef DECLARATIVEAREASERIES_H
22 #define DECLARATIVEAREASERIES_H
22 #define DECLARATIVEAREASERIES_H
23
23
24 #include "qchartglobal.h"
25 #include "qareaseries.h"
24 #include "qareaseries.h"
26 #include "declarativelineseries.h"
25 #include "declarativelineseries.h"
27 #include "qabstractaxis.h"
28
26
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30
28
31 class DeclarativeAreaSeries : public QAreaSeries
29 class DeclarativeAreaSeries : public QAreaSeries
32 {
30 {
33 Q_OBJECT
31 Q_OBJECT
34 Q_PROPERTY(DeclarativeLineSeries *upperSeries READ upperSeries WRITE setUpperSeries)
32 Q_PROPERTY(DeclarativeLineSeries *upperSeries READ upperSeries WRITE setUpperSeries)
35 Q_PROPERTY(DeclarativeLineSeries *lowerSeries READ lowerSeries WRITE setLowerSeries)
33 Q_PROPERTY(DeclarativeLineSeries *lowerSeries READ lowerSeries WRITE setLowerSeries)
36
34
37 public:
35 public:
38 explicit DeclarativeAreaSeries(QObject *parent = 0);
36 explicit DeclarativeAreaSeries(QObject *parent = 0);
39 void setUpperSeries(DeclarativeLineSeries* series);
37 void setUpperSeries(DeclarativeLineSeries* series);
40 DeclarativeLineSeries* upperSeries() const;
38 DeclarativeLineSeries* upperSeries() const;
41 void setLowerSeries(DeclarativeLineSeries* series);
39 void setLowerSeries(DeclarativeLineSeries* series);
42 DeclarativeLineSeries* lowerSeries() const;
40 DeclarativeLineSeries* lowerSeries() const;
43 };
41 };
44
42
45 QTCOMMERCIALCHART_END_NAMESPACE
43 QTCOMMERCIALCHART_END_NAMESPACE
46
44
47 #endif // DECLARATIVEAREASERIES_H
45 #endif // DECLARATIVEAREASERIES_H
@@ -1,234 +1,232
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 "declarativebarseries.h"
21 #include "declarativebarseries.h"
22 #include "declarativechart.h"
23 #include <QBarSet>
22 #include <QBarSet>
24 #include <QVBarModelMapper>
23 #include <QVBarModelMapper>
25 #include <QHBarModelMapper>
24 #include <QHBarModelMapper>
26 #include <QAbstractAxis>
27
25
28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29
27
30 DeclarativeBarSet::DeclarativeBarSet(QObject *parent) :
28 DeclarativeBarSet::DeclarativeBarSet(QObject *parent) :
31 QBarSet("", parent)
29 QBarSet("", parent)
32 {
30 {
33 connect(this, SIGNAL(valuesAdded(int,int)), this, SLOT(handleCountChanged(int, int)));
31 connect(this, SIGNAL(valuesAdded(int,int)), this, SLOT(handleCountChanged(int, int)));
34 connect(this, SIGNAL(valuesRemoved(int,int)), this, SLOT(handleCountChanged(int, int)));
32 connect(this, SIGNAL(valuesRemoved(int,int)), this, SLOT(handleCountChanged(int, int)));
35 }
33 }
36
34
37 void DeclarativeBarSet::handleCountChanged(int index, int count)
35 void DeclarativeBarSet::handleCountChanged(int index, int count)
38 {
36 {
39 Q_UNUSED(index)
37 Q_UNUSED(index)
40 Q_UNUSED(count)
38 Q_UNUSED(count)
41 emit countChanged(QBarSet::count());
39 emit countChanged(QBarSet::count());
42 }
40 }
43
41
44 QVariantList DeclarativeBarSet::values()
42 QVariantList DeclarativeBarSet::values()
45 {
43 {
46 QVariantList values;
44 QVariantList values;
47 for (int i(0); i < count(); i++)
45 for (int i(0); i < count(); i++)
48 values.append(QVariant(QBarSet::at(i)));
46 values.append(QVariant(QBarSet::at(i)));
49 return values;
47 return values;
50 }
48 }
51
49
52 void DeclarativeBarSet::setValues(QVariantList values)
50 void DeclarativeBarSet::setValues(QVariantList values)
53 {
51 {
54 while (count())
52 while (count())
55 remove(count() - 1);
53 remove(count() - 1);
56
54
57 for (int i(0); i < values.count(); i++) {
55 for (int i(0); i < values.count(); i++) {
58 if (values.at(i).canConvert(QVariant::Double))
56 if (values.at(i).canConvert(QVariant::Double))
59 QBarSet::append(values[i].toDouble());
57 QBarSet::append(values[i].toDouble());
60 }
58 }
61 }
59 }
62
60
63 DeclarativeBarSeries::DeclarativeBarSeries(QDeclarativeItem *parent) :
61 DeclarativeBarSeries::DeclarativeBarSeries(QDeclarativeItem *parent) :
64 QBarSeries(parent)
62 QBarSeries(parent)
65 {
63 {
66 }
64 }
67
65
68 void DeclarativeBarSeries::classBegin()
66 void DeclarativeBarSeries::classBegin()
69 {
67 {
70 }
68 }
71
69
72 void DeclarativeBarSeries::componentComplete()
70 void DeclarativeBarSeries::componentComplete()
73 {
71 {
74 foreach(QObject *child, children()) {
72 foreach(QObject *child, children()) {
75 if (qobject_cast<DeclarativeBarSet *>(child)) {
73 if (qobject_cast<DeclarativeBarSet *>(child)) {
76 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
74 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
77 } else if(qobject_cast<QVBarModelMapper *>(child)) {
75 } else if(qobject_cast<QVBarModelMapper *>(child)) {
78 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
76 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
79 mapper->setSeries(this);
77 mapper->setSeries(this);
80 } else if(qobject_cast<QHBarModelMapper *>(child)) {
78 } else if(qobject_cast<QHBarModelMapper *>(child)) {
81 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
79 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
82 mapper->setSeries(this);
80 mapper->setSeries(this);
83 }
81 }
84 }
82 }
85 }
83 }
86
84
87 QDeclarativeListProperty<QObject> DeclarativeBarSeries::seriesChildren()
85 QDeclarativeListProperty<QObject> DeclarativeBarSeries::seriesChildren()
88 {
86 {
89 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren);
87 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren);
90 }
88 }
91
89
92 void DeclarativeBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
90 void DeclarativeBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
93 {
91 {
94 // Empty implementation; the children are parsed in componentComplete instead
92 // Empty implementation; the children are parsed in componentComplete instead
95 Q_UNUSED(list);
93 Q_UNUSED(list);
96 Q_UNUSED(element);
94 Q_UNUSED(element);
97 }
95 }
98
96
99 DeclarativeBarSet *DeclarativeBarSeries::at(int index)
97 DeclarativeBarSet *DeclarativeBarSeries::at(int index)
100 {
98 {
101 QList<QBarSet*> setList = barSets();
99 QList<QBarSet*> setList = barSets();
102 if (index >= 0 && index < setList.count())
100 if (index >= 0 && index < setList.count())
103 return qobject_cast<DeclarativeBarSet *>(setList[index]);
101 return qobject_cast<DeclarativeBarSet *>(setList[index]);
104
102
105 return 0;
103 return 0;
106 }
104 }
107
105
108 DeclarativeBarSet *DeclarativeBarSeries::insert(int index, QString label, QVariantList values)
106 DeclarativeBarSet *DeclarativeBarSeries::insert(int index, QString label, QVariantList values)
109 {
107 {
110 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
108 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
111 barset->setLabel(label);
109 barset->setLabel(label);
112 barset->setValues(values);
110 barset->setValues(values);
113 if (QBarSeries::insert(index, barset))
111 if (QBarSeries::insert(index, barset))
114 return barset;
112 return barset;
115 delete barset;
113 delete barset;
116 return 0;
114 return 0;
117 }
115 }
118
116
119 DeclarativeStackedBarSeries::DeclarativeStackedBarSeries(QDeclarativeItem *parent) :
117 DeclarativeStackedBarSeries::DeclarativeStackedBarSeries(QDeclarativeItem *parent) :
120 QStackedBarSeries(parent)
118 QStackedBarSeries(parent)
121 {
119 {
122 }
120 }
123
121
124 void DeclarativeStackedBarSeries::classBegin()
122 void DeclarativeStackedBarSeries::classBegin()
125 {
123 {
126 }
124 }
127
125
128 void DeclarativeStackedBarSeries::componentComplete()
126 void DeclarativeStackedBarSeries::componentComplete()
129 {
127 {
130 foreach(QObject *child, children()) {
128 foreach(QObject *child, children()) {
131 if (qobject_cast<DeclarativeBarSet *>(child)) {
129 if (qobject_cast<DeclarativeBarSet *>(child)) {
132 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
130 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
133 } else if(qobject_cast<QVBarModelMapper *>(child)) {
131 } else if(qobject_cast<QVBarModelMapper *>(child)) {
134 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
132 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
135 mapper->setSeries(this);
133 mapper->setSeries(this);
136 } else if(qobject_cast<QHBarModelMapper *>(child)) {
134 } else if(qobject_cast<QHBarModelMapper *>(child)) {
137 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
135 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
138 mapper->setSeries(this);
136 mapper->setSeries(this);
139 }
137 }
140 }
138 }
141 }
139 }
142
140
143
141
144 QDeclarativeListProperty<QObject> DeclarativeStackedBarSeries::seriesChildren()
142 QDeclarativeListProperty<QObject> DeclarativeStackedBarSeries::seriesChildren()
145 {
143 {
146 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren);
144 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren);
147 }
145 }
148
146
149 void DeclarativeStackedBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
147 void DeclarativeStackedBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
150 {
148 {
151 // Empty implementation; the children are parsed in componentComplete instead
149 // Empty implementation; the children are parsed in componentComplete instead
152 Q_UNUSED(list);
150 Q_UNUSED(list);
153 Q_UNUSED(element);
151 Q_UNUSED(element);
154 }
152 }
155
153
156 DeclarativeBarSet *DeclarativeStackedBarSeries::at(int index)
154 DeclarativeBarSet *DeclarativeStackedBarSeries::at(int index)
157 {
155 {
158 QList<QBarSet*> setList = barSets();
156 QList<QBarSet*> setList = barSets();
159 if (index >= 0 && index < setList.count())
157 if (index >= 0 && index < setList.count())
160 return qobject_cast<DeclarativeBarSet *>(setList[index]);
158 return qobject_cast<DeclarativeBarSet *>(setList[index]);
161
159
162 return 0;
160 return 0;
163 }
161 }
164
162
165 DeclarativeBarSet *DeclarativeStackedBarSeries::insert(int index, QString label, QVariantList values)
163 DeclarativeBarSet *DeclarativeStackedBarSeries::insert(int index, QString label, QVariantList values)
166 {
164 {
167 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
165 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
168 barset->setLabel(label);
166 barset->setLabel(label);
169 barset->setValues(values);
167 barset->setValues(values);
170 if (QStackedBarSeries::insert(index, barset))
168 if (QStackedBarSeries::insert(index, barset))
171 return barset;
169 return barset;
172 delete barset;
170 delete barset;
173 return 0;
171 return 0;
174 }
172 }
175
173
176 DeclarativePercentBarSeries::DeclarativePercentBarSeries(QDeclarativeItem *parent) :
174 DeclarativePercentBarSeries::DeclarativePercentBarSeries(QDeclarativeItem *parent) :
177 QPercentBarSeries(parent)
175 QPercentBarSeries(parent)
178 {
176 {
179 }
177 }
180
178
181 void DeclarativePercentBarSeries::classBegin()
179 void DeclarativePercentBarSeries::classBegin()
182 {
180 {
183 }
181 }
184
182
185 void DeclarativePercentBarSeries::componentComplete()
183 void DeclarativePercentBarSeries::componentComplete()
186 {
184 {
187 foreach(QObject *child, children()) {
185 foreach(QObject *child, children()) {
188 if (qobject_cast<DeclarativeBarSet *>(child)) {
186 if (qobject_cast<DeclarativeBarSet *>(child)) {
189 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
187 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
190 } else if(qobject_cast<QVBarModelMapper *>(child)) {
188 } else if(qobject_cast<QVBarModelMapper *>(child)) {
191 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
189 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
192 mapper->setSeries(this);
190 mapper->setSeries(this);
193 } else if(qobject_cast<QHBarModelMapper *>(child)) {
191 } else if(qobject_cast<QHBarModelMapper *>(child)) {
194 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
192 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
195 mapper->setSeries(this);
193 mapper->setSeries(this);
196 }
194 }
197 }
195 }
198 }
196 }
199
197
200 QDeclarativeListProperty<QObject> DeclarativePercentBarSeries::seriesChildren()
198 QDeclarativeListProperty<QObject> DeclarativePercentBarSeries::seriesChildren()
201 {
199 {
202 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren);
200 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren);
203 }
201 }
204
202
205 void DeclarativePercentBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
203 void DeclarativePercentBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
206 {
204 {
207 // Empty implementation; the children are parsed in componentComplete instead
205 // Empty implementation; the children are parsed in componentComplete instead
208 Q_UNUSED(list);
206 Q_UNUSED(list);
209 Q_UNUSED(element);
207 Q_UNUSED(element);
210 }
208 }
211
209
212 DeclarativeBarSet *DeclarativePercentBarSeries::at(int index)
210 DeclarativeBarSet *DeclarativePercentBarSeries::at(int index)
213 {
211 {
214 QList<QBarSet*> setList = barSets();
212 QList<QBarSet*> setList = barSets();
215 if (index >= 0 && index < setList.count())
213 if (index >= 0 && index < setList.count())
216 return qobject_cast<DeclarativeBarSet *>(setList[index]);
214 return qobject_cast<DeclarativeBarSet *>(setList[index]);
217
215
218 return 0;
216 return 0;
219 }
217 }
220
218
221 DeclarativeBarSet *DeclarativePercentBarSeries::insert(int index, QString label, QVariantList values)
219 DeclarativeBarSet *DeclarativePercentBarSeries::insert(int index, QString label, QVariantList values)
222 {
220 {
223 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
221 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
224 barset->setLabel(label);
222 barset->setLabel(label);
225 barset->setValues(values);
223 barset->setValues(values);
226 if (QPercentBarSeries::insert(index, barset))
224 if (QPercentBarSeries::insert(index, barset))
227 return barset;
225 return barset;
228 delete barset;
226 delete barset;
229 return 0;
227 return 0;
230 }
228 }
231
229
232 #include "moc_declarativebarseries.cpp"
230 #include "moc_declarativebarseries.cpp"
233
231
234 QTCOMMERCIALCHART_END_NAMESPACE
232 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,141 +1,138
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 DECLARATIVEBARSERIES_H
21 #ifndef DECLARATIVEBARSERIES_H
22 #define DECLARATIVEBARSERIES_H
22 #define DECLARATIVEBARSERIES_H
23
23
24 #include "qchartglobal.h"
25 #include "qabstractbarseries.h"
26 #include "qbarseries.h"
24 #include "qbarseries.h"
27 #include "qstackedbarseries.h"
25 #include "qstackedbarseries.h"
28 #include "qpercentbarseries.h"
26 #include "qpercentbarseries.h"
29 #include "qbarset.h"
27 #include "qbarset.h"
30 #include "qabstractaxis.h"
31 #include <QDeclarativeItem>
28 #include <QDeclarativeItem>
32 #include <QDeclarativeParserStatus>
29 #include <QDeclarativeParserStatus>
33
30
34 QTCOMMERCIALCHART_BEGIN_NAMESPACE
31 QTCOMMERCIALCHART_BEGIN_NAMESPACE
35
32
36 class QChart;
33 class QChart;
37
34
38 class DeclarativeBarSet : public QBarSet
35 class DeclarativeBarSet : public QBarSet
39 {
36 {
40 Q_OBJECT
37 Q_OBJECT
41 Q_PROPERTY(QVariantList values READ values WRITE setValues)
38 Q_PROPERTY(QVariantList values READ values WRITE setValues)
42 Q_PROPERTY(int count READ count NOTIFY countChanged)
39 Q_PROPERTY(int count READ count NOTIFY countChanged)
43
40
44 public:
41 public:
45 explicit DeclarativeBarSet(QObject *parent = 0);
42 explicit DeclarativeBarSet(QObject *parent = 0);
46 QVariantList values();
43 QVariantList values();
47 void setValues(QVariantList values);
44 void setValues(QVariantList values);
48
45
49 public: // From QBarSet
46 public: // From QBarSet
50 Q_INVOKABLE void append(qreal value) { QBarSet::append(value); }
47 Q_INVOKABLE void append(qreal value) { QBarSet::append(value); }
51 Q_INVOKABLE void remove(const int index, const int count = 1) { QBarSet::remove(index, count); }
48 Q_INVOKABLE void remove(const int index, const int count = 1) { QBarSet::remove(index, count); }
52 Q_INVOKABLE void replace(int index, qreal value) { QBarSet::replace(index, value); }
49 Q_INVOKABLE void replace(int index, qreal value) { QBarSet::replace(index, value); }
53 Q_INVOKABLE qreal at(int index) { return QBarSet::at(index); }
50 Q_INVOKABLE qreal at(int index) { return QBarSet::at(index); }
54
51
55 Q_SIGNALS:
52 Q_SIGNALS:
56 void countChanged(int count);
53 void countChanged(int count);
57
54
58 private Q_SLOTS:
55 private Q_SLOTS:
59 void handleCountChanged(int index, int count);
56 void handleCountChanged(int index, int count);
60 };
57 };
61
58
62 class DeclarativeBarSeries : public QBarSeries, public QDeclarativeParserStatus
59 class DeclarativeBarSeries : public QBarSeries, public QDeclarativeParserStatus
63 {
60 {
64 Q_OBJECT
61 Q_OBJECT
65 Q_INTERFACES(QDeclarativeParserStatus)
62 Q_INTERFACES(QDeclarativeParserStatus)
66 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
63 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
67 Q_CLASSINFO("DefaultProperty", "seriesChildren")
64 Q_CLASSINFO("DefaultProperty", "seriesChildren")
68
65
69 public:
66 public:
70 explicit DeclarativeBarSeries(QDeclarativeItem *parent = 0);
67 explicit DeclarativeBarSeries(QDeclarativeItem *parent = 0);
71 QDeclarativeListProperty<QObject> seriesChildren();
68 QDeclarativeListProperty<QObject> seriesChildren();
72 Q_INVOKABLE DeclarativeBarSet *at(int index);
69 Q_INVOKABLE DeclarativeBarSet *at(int index);
73 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
70 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
74 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
71 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
75 Q_INVOKABLE bool remove(QBarSet *barset) { return QBarSeries::remove(barset); }
72 Q_INVOKABLE bool remove(QBarSet *barset) { return QBarSeries::remove(barset); }
76 Q_INVOKABLE void clear() { return QBarSeries::clear(); }
73 Q_INVOKABLE void clear() { return QBarSeries::clear(); }
77
74
78 public: // from QDeclarativeParserStatus
75 public: // from QDeclarativeParserStatus
79 void classBegin();
76 void classBegin();
80 void componentComplete();
77 void componentComplete();
81
78
82 public Q_SLOTS:
79 public Q_SLOTS:
83 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
80 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
84
81
85 private:
82 private:
86 QAbstractAxis* m_axisX;
83 QAbstractAxis* m_axisX;
87 QAbstractAxis* m_axisY;
84 QAbstractAxis* m_axisY;
88 };
85 };
89
86
90 class DeclarativeStackedBarSeries : public QStackedBarSeries, public QDeclarativeParserStatus
87 class DeclarativeStackedBarSeries : public QStackedBarSeries, public QDeclarativeParserStatus
91 {
88 {
92 Q_OBJECT
89 Q_OBJECT
93 Q_INTERFACES(QDeclarativeParserStatus)
90 Q_INTERFACES(QDeclarativeParserStatus)
94 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
91 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
95 Q_CLASSINFO("DefaultProperty", "seriesChildren")
92 Q_CLASSINFO("DefaultProperty", "seriesChildren")
96
93
97 public:
94 public:
98 explicit DeclarativeStackedBarSeries(QDeclarativeItem *parent = 0);
95 explicit DeclarativeStackedBarSeries(QDeclarativeItem *parent = 0);
99 QDeclarativeListProperty<QObject> seriesChildren();
96 QDeclarativeListProperty<QObject> seriesChildren();
100 Q_INVOKABLE DeclarativeBarSet *at(int index);
97 Q_INVOKABLE DeclarativeBarSet *at(int index);
101 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
98 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
102 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
99 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
103 Q_INVOKABLE bool remove(QBarSet *barset) { return QStackedBarSeries::remove(barset); }
100 Q_INVOKABLE bool remove(QBarSet *barset) { return QStackedBarSeries::remove(barset); }
104 Q_INVOKABLE void clear() { return QStackedBarSeries::clear(); }
101 Q_INVOKABLE void clear() { return QStackedBarSeries::clear(); }
105
102
106 public: // from QDeclarativeParserStatus
103 public: // from QDeclarativeParserStatus
107 void classBegin();
104 void classBegin();
108 void componentComplete();
105 void componentComplete();
109
106
110 public Q_SLOTS:
107 public Q_SLOTS:
111 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
108 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
112
109
113 };
110 };
114
111
115 class DeclarativePercentBarSeries : public QPercentBarSeries, public QDeclarativeParserStatus
112 class DeclarativePercentBarSeries : public QPercentBarSeries, public QDeclarativeParserStatus
116 {
113 {
117 Q_OBJECT
114 Q_OBJECT
118 Q_INTERFACES(QDeclarativeParserStatus)
115 Q_INTERFACES(QDeclarativeParserStatus)
119 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
116 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
120 Q_CLASSINFO("DefaultProperty", "seriesChildren")
117 Q_CLASSINFO("DefaultProperty", "seriesChildren")
121
118
122 public:
119 public:
123 explicit DeclarativePercentBarSeries(QDeclarativeItem *parent = 0);
120 explicit DeclarativePercentBarSeries(QDeclarativeItem *parent = 0);
124 QDeclarativeListProperty<QObject> seriesChildren();
121 QDeclarativeListProperty<QObject> seriesChildren();
125 Q_INVOKABLE DeclarativeBarSet *at(int index);
122 Q_INVOKABLE DeclarativeBarSet *at(int index);
126 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
123 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
127 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
124 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
128 Q_INVOKABLE bool remove(QBarSet *barset) { return QPercentBarSeries::remove(barset); }
125 Q_INVOKABLE bool remove(QBarSet *barset) { return QPercentBarSeries::remove(barset); }
129 Q_INVOKABLE void clear() { return QPercentBarSeries::clear(); }
126 Q_INVOKABLE void clear() { return QPercentBarSeries::clear(); }
130
127
131 public: // from QDeclarativeParserStatus
128 public: // from QDeclarativeParserStatus
132 void classBegin();
129 void classBegin();
133 void componentComplete();
130 void componentComplete();
134
131
135 public Q_SLOTS:
132 public Q_SLOTS:
136 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
133 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
137 };
134 };
138
135
139 QTCOMMERCIALCHART_END_NAMESPACE
136 QTCOMMERCIALCHART_END_NAMESPACE
140
137
141 #endif // DECLARATIVEBARSERIES_H
138 #endif // DECLARATIVEBARSERIES_H
@@ -1,60 +1,57
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 "declarativelineseries.h"
21 #include "declarativelineseries.h"
22 #include "declarativechart.h"
23 #include "qchart.h"
24 #include "qlineseries.h"
25
22
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
23 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27
24
28 DeclarativeLineSeries::DeclarativeLineSeries(QObject *parent) :
25 DeclarativeLineSeries::DeclarativeLineSeries(QObject *parent) :
29 QLineSeries(parent)
26 QLineSeries(parent)
30 {
27 {
31 connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
28 connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
32 connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
29 connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
33 }
30 }
34
31
35 QXYSeries *DeclarativeLineSeries::xySeries()
32 QXYSeries *DeclarativeLineSeries::xySeries()
36 {
33 {
37 return this;
34 return this;
38 }
35 }
39
36
40 void DeclarativeLineSeries::handleCountChanged(int index)
37 void DeclarativeLineSeries::handleCountChanged(int index)
41 {
38 {
42 Q_UNUSED(index)
39 Q_UNUSED(index)
43 emit countChanged(points().count());
40 emit countChanged(points().count());
44 }
41 }
45
42
46 QDeclarativeListProperty<QObject> DeclarativeLineSeries::declarativeChildren()
43 QDeclarativeListProperty<QObject> DeclarativeLineSeries::declarativeChildren()
47 {
44 {
48 return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren);
45 return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren);
49 }
46 }
50
47
51 void DeclarativeLineSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element)
48 void DeclarativeLineSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element)
52 {
49 {
53 Q_UNUSED(list)
50 Q_UNUSED(list)
54 Q_UNUSED(element)
51 Q_UNUSED(element)
55 // Empty implementation, childs are parsed in componentComplete
52 // Empty implementation, childs are parsed in componentComplete
56 }
53 }
57
54
58 #include "moc_declarativelineseries.cpp"
55 #include "moc_declarativelineseries.cpp"
59
56
60 QTCOMMERCIALCHART_END_NAMESPACE
57 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,69 +1,66
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 DECLARATIVELINESERIES_H
21 #ifndef DECLARATIVELINESERIES_H
22 #define DECLARATIVELINESERIES_H
22 #define DECLARATIVELINESERIES_H
23
23
24 #include "qchartglobal.h"
25 #include "qlineseries.h"
24 #include "qlineseries.h"
26 #include "declarativexyseries.h"
25 #include "declarativexyseries.h"
27 #include "qabstractaxis.h"
28 #include <QDeclarativeParserStatus>
29 #include <QDeclarativeListProperty>
26 #include <QDeclarativeListProperty>
30 #include <QDeclarativeParserStatus>
27 #include <QDeclarativeParserStatus>
31
28
32 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
33
30
34 class DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries, public QDeclarativeParserStatus
31 class DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries, public QDeclarativeParserStatus
35 {
32 {
36 Q_OBJECT
33 Q_OBJECT
37 Q_INTERFACES(QDeclarativeParserStatus)
34 Q_INTERFACES(QDeclarativeParserStatus)
38 Q_PROPERTY(int count READ count NOTIFY countChanged)
35 Q_PROPERTY(int count READ count NOTIFY countChanged)
39 Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
36 Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
40 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
37 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
41
38
42 public:
39 public:
43 explicit DeclarativeLineSeries(QObject *parent = 0);
40 explicit DeclarativeLineSeries(QObject *parent = 0);
44 QXYSeries *xySeries();
41 QXYSeries *xySeries();
45 QDeclarativeListProperty<QObject> declarativeChildren();
42 QDeclarativeListProperty<QObject> declarativeChildren();
46
43
47 public: // from QDeclarativeParserStatus
44 public: // from QDeclarativeParserStatus
48 void classBegin() { DeclarativeXySeries::classBegin(); }
45 void classBegin() { DeclarativeXySeries::classBegin(); }
49 void componentComplete() { DeclarativeXySeries::componentComplete(); }
46 void componentComplete() { DeclarativeXySeries::componentComplete(); }
50
47
51 public:
48 public:
52 Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
49 Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
53 Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
50 Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
54 Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
51 Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
55 Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
52 Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
56 Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
53 Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
57 Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
54 Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
58
55
59 Q_SIGNALS:
56 Q_SIGNALS:
60 void countChanged(int count);
57 void countChanged(int count);
61
58
62 public Q_SLOTS:
59 public Q_SLOTS:
63 static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
60 static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
64 void handleCountChanged(int index);
61 void handleCountChanged(int index);
65 };
62 };
66
63
67 QTCOMMERCIALCHART_END_NAMESPACE
64 QTCOMMERCIALCHART_END_NAMESPACE
68
65
69 #endif // DECLARATIVELINESERIES_H
66 #endif // DECLARATIVELINESERIES_H
@@ -1,120 +1,117
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 "declarativepieseries.h"
21 #include "declarativepieseries.h"
22 #include "declarativechart.h"
23 #include "qchart.h"
24 #include <qdeclarativelist.h>
25 #include <QVPieModelMapper>
22 #include <QVPieModelMapper>
26 #include <QHPieModelMapper>
23 #include <QHPieModelMapper>
27
24
28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
25 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29
26
30 DeclarativePieSeries::DeclarativePieSeries(QObject *parent) :
27 DeclarativePieSeries::DeclarativePieSeries(QDeclarativeItem *parent) :
31 QPieSeries(parent)
28 QPieSeries(parent)
32 {
29 {
33 connect(this, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleAdded(QList<QPieSlice*>)));
30 connect(this, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleAdded(QList<QPieSlice*>)));
34 connect(this, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleRemoved(QList<QPieSlice*>)));
31 connect(this, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleRemoved(QList<QPieSlice*>)));
35 }
32 }
36
33
37 void DeclarativePieSeries::classBegin()
34 void DeclarativePieSeries::classBegin()
38 {
35 {
39 }
36 }
40
37
41 void DeclarativePieSeries::componentComplete()
38 void DeclarativePieSeries::componentComplete()
42 {
39 {
43 foreach(QObject *child, children()) {
40 foreach(QObject *child, children()) {
44 if (qobject_cast<QPieSlice *>(child)) {
41 if (qobject_cast<QPieSlice *>(child)) {
45 QPieSeries::append(qobject_cast<QPieSlice *>(child));
42 QPieSeries::append(qobject_cast<QPieSlice *>(child));
46 } else if(qobject_cast<QVPieModelMapper *>(child)) {
43 } else if(qobject_cast<QVPieModelMapper *>(child)) {
47 QVPieModelMapper *mapper = qobject_cast<QVPieModelMapper *>(child);
44 QVPieModelMapper *mapper = qobject_cast<QVPieModelMapper *>(child);
48 mapper->setSeries(this);
45 mapper->setSeries(this);
49 } else if(qobject_cast<QHPieModelMapper *>(child)) {
46 } else if(qobject_cast<QHPieModelMapper *>(child)) {
50 QHPieModelMapper *mapper = qobject_cast<QHPieModelMapper *>(child);
47 QHPieModelMapper *mapper = qobject_cast<QHPieModelMapper *>(child);
51 mapper->setSeries(this);
48 mapper->setSeries(this);
52 }
49 }
53 }
50 }
54 }
51 }
55
52
56 QDeclarativeListProperty<QObject> DeclarativePieSeries::seriesChildren()
53 QDeclarativeListProperty<QObject> DeclarativePieSeries::seriesChildren()
57 {
54 {
58 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativePieSeries::appendSeriesChildren);
55 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativePieSeries::appendSeriesChildren);
59 }
56 }
60
57
61 void DeclarativePieSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
58 void DeclarativePieSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
62 {
59 {
63 // Empty implementation; the children are parsed in componentComplete instead
60 // Empty implementation; the children are parsed in componentComplete instead
64 Q_UNUSED(list);
61 Q_UNUSED(list);
65 Q_UNUSED(element);
62 Q_UNUSED(element);
66 }
63 }
67
64
68 QPieSlice *DeclarativePieSeries::at(int index)
65 QPieSlice *DeclarativePieSeries::at(int index)
69 {
66 {
70 QList<QPieSlice*> sliceList = slices();
67 QList<QPieSlice*> sliceList = slices();
71 if (index >= 0 && index < sliceList.count())
68 if (index >= 0 && index < sliceList.count())
72 return sliceList[index];
69 return sliceList[index];
73
70
74 return 0;
71 return 0;
75 }
72 }
76
73
77 QPieSlice* DeclarativePieSeries::find(QString label)
74 QPieSlice* DeclarativePieSeries::find(QString label)
78 {
75 {
79 foreach (QPieSlice *slice, slices()) {
76 foreach (QPieSlice *slice, slices()) {
80 if (slice->label() == label)
77 if (slice->label() == label)
81 return slice;
78 return slice;
82 }
79 }
83 return 0;
80 return 0;
84 }
81 }
85
82
86 QPieSlice* DeclarativePieSeries::append(QString label, qreal value)
83 QPieSlice* DeclarativePieSeries::append(QString label, qreal value)
87 {
84 {
88 // TODO: parameter order is wrong, switch it:
85 // TODO: parameter order is wrong, switch it:
89 QPieSlice *slice = new QPieSlice(this);
86 QPieSlice *slice = new QPieSlice(this);
90 slice->setLabel(label);
87 slice->setLabel(label);
91 slice->setValue(value);
88 slice->setValue(value);
92 QPieSeries::append(slice);
89 QPieSeries::append(slice);
93 return slice;
90 return slice;
94 }
91 }
95
92
96 bool DeclarativePieSeries::remove(QPieSlice *slice)
93 bool DeclarativePieSeries::remove(QPieSlice *slice)
97 {
94 {
98 return QPieSeries::remove(slice);
95 return QPieSeries::remove(slice);
99 }
96 }
100
97
101 void DeclarativePieSeries::clear()
98 void DeclarativePieSeries::clear()
102 {
99 {
103 QPieSeries::clear();
100 QPieSeries::clear();
104 }
101 }
105
102
106 void DeclarativePieSeries::handleAdded(QList<QPieSlice*> slices)
103 void DeclarativePieSeries::handleAdded(QList<QPieSlice*> slices)
107 {
104 {
108 foreach(QPieSlice *slice, slices)
105 foreach(QPieSlice *slice, slices)
109 emit sliceAdded(slice);
106 emit sliceAdded(slice);
110 }
107 }
111
108
112 void DeclarativePieSeries::handleRemoved(QList<QPieSlice*> slices)
109 void DeclarativePieSeries::handleRemoved(QList<QPieSlice*> slices)
113 {
110 {
114 foreach(QPieSlice *slice, slices)
111 foreach(QPieSlice *slice, slices)
115 emit sliceRemoved(slice);
112 emit sliceRemoved(slice);
116 }
113 }
117
114
118 #include "moc_declarativepieseries.cpp"
115 #include "moc_declarativepieseries.cpp"
119
116
120 QTCOMMERCIALCHART_END_NAMESPACE
117 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,67 +1,63
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 DECLARATIVEPIESERIES_H
21 #ifndef DECLARATIVEPIESERIES_H
22 #define DECLARATIVEPIESERIES_H
22 #define DECLARATIVEPIESERIES_H
23
23
24 #include "qchartglobal.h"
24 #include "qpieslice.h"
25 #include <QPieSlice>
25 #include "qpieseries.h"
26 #include <QPieSeries>
26 #include <QDeclarativeItem>
27 #include <QDeclarativeParserStatus>
27 #include <QDeclarativeParserStatus>
28 #include <QDeclarativeListProperty>
29 #include <QAbstractItemModel>
30
28
31 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
32
30
33 class QChart;
34
35 class DeclarativePieSeries : public QPieSeries, public QDeclarativeParserStatus
31 class DeclarativePieSeries : public QPieSeries, public QDeclarativeParserStatus
36 {
32 {
37 Q_OBJECT
33 Q_OBJECT
38 Q_INTERFACES(QDeclarativeParserStatus)
34 Q_INTERFACES(QDeclarativeParserStatus)
39 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
35 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
40 Q_CLASSINFO("DefaultProperty", "seriesChildren")
36 Q_CLASSINFO("DefaultProperty", "seriesChildren")
41
37
42 public:
38 public:
43 explicit DeclarativePieSeries(QObject *parent = 0);
39 explicit DeclarativePieSeries(QDeclarativeItem *parent = 0);
44 QDeclarativeListProperty<QObject> seriesChildren();
40 QDeclarativeListProperty<QObject> seriesChildren();
45 Q_INVOKABLE QPieSlice *at(int index);
41 Q_INVOKABLE QPieSlice *at(int index);
46 Q_INVOKABLE QPieSlice *find(QString label);
42 Q_INVOKABLE QPieSlice *find(QString label);
47 Q_INVOKABLE QPieSlice *append(QString label, qreal value);
43 Q_INVOKABLE QPieSlice *append(QString label, qreal value);
48 Q_INVOKABLE bool remove(QPieSlice *slice);
44 Q_INVOKABLE bool remove(QPieSlice *slice);
49 Q_INVOKABLE void clear();
45 Q_INVOKABLE void clear();
50
46
51 public:
47 public:
52 void classBegin();
48 void classBegin();
53 void componentComplete();
49 void componentComplete();
54
50
55 Q_SIGNALS:
51 Q_SIGNALS:
56 void sliceAdded(QPieSlice* slice);
52 void sliceAdded(QPieSlice* slice);
57 void sliceRemoved(QPieSlice* slice);
53 void sliceRemoved(QPieSlice* slice);
58
54
59 public Q_SLOTS:
55 public Q_SLOTS:
60 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
56 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
61 void handleAdded(QList<QPieSlice*> slices);
57 void handleAdded(QList<QPieSlice*> slices);
62 void handleRemoved(QList<QPieSlice*> slices);
58 void handleRemoved(QList<QPieSlice*> slices);
63 };
59 };
64
60
65 QTCOMMERCIALCHART_END_NAMESPACE
61 QTCOMMERCIALCHART_END_NAMESPACE
66
62
67 #endif // DECLARATIVEPIESERIES_H
63 #endif // DECLARATIVEPIESERIES_H
@@ -1,60 +1,57
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 "declarativescatterseries.h"
21 #include "declarativescatterseries.h"
22 #include "declarativechart.h"
23 #include "qchart.h"
24 #include "qscatterseries.h"
25
22
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
23 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27
24
28 DeclarativeScatterSeries::DeclarativeScatterSeries(QObject *parent) :
25 DeclarativeScatterSeries::DeclarativeScatterSeries(QObject *parent) :
29 QScatterSeries(parent)
26 QScatterSeries(parent)
30 {
27 {
31 connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
28 connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
32 connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
29 connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
33 }
30 }
34
31
35 QXYSeries *DeclarativeScatterSeries::xySeries()
32 QXYSeries *DeclarativeScatterSeries::xySeries()
36 {
33 {
37 return this;
34 return this;
38 }
35 }
39
36
40 void DeclarativeScatterSeries::handleCountChanged(int index)
37 void DeclarativeScatterSeries::handleCountChanged(int index)
41 {
38 {
42 Q_UNUSED(index)
39 Q_UNUSED(index)
43 emit countChanged(QScatterSeries::count());
40 emit countChanged(QScatterSeries::count());
44 }
41 }
45
42
46 QDeclarativeListProperty<QObject> DeclarativeScatterSeries::declarativeChildren()
43 QDeclarativeListProperty<QObject> DeclarativeScatterSeries::declarativeChildren()
47 {
44 {
48 return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren);
45 return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren);
49 }
46 }
50
47
51 void DeclarativeScatterSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element)
48 void DeclarativeScatterSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element)
52 {
49 {
53 Q_UNUSED(list)
50 Q_UNUSED(list)
54 Q_UNUSED(element)
51 Q_UNUSED(element)
55 // Empty implementation, childs are parsed in componentComplete
52 // Empty implementation, childs are parsed in componentComplete
56 }
53 }
57
54
58 #include "moc_declarativescatterseries.cpp"
55 #include "moc_declarativescatterseries.cpp"
59
56
60 QTCOMMERCIALCHART_END_NAMESPACE
57 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,68 +1,66
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 DECLARATIVESCATTERSERIES_H
21 #ifndef DECLARATIVESCATTERSERIES_H
22 #define DECLARATIVESCATTERSERIES_H
22 #define DECLARATIVESCATTERSERIES_H
23
23
24 #include "qchartglobal.h"
25 #include "qscatterseries.h"
24 #include "qscatterseries.h"
26 #include "declarativexyseries.h"
25 #include "declarativexyseries.h"
27 #include "qabstractaxis.h"
28 #include <QDeclarativeListProperty>
26 #include <QDeclarativeListProperty>
29 #include <QDeclarativeParserStatus>
27 #include <QDeclarativeParserStatus>
30
28
31 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
32
30
33 class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries, public QDeclarativeParserStatus
31 class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries, public QDeclarativeParserStatus
34 {
32 {
35 Q_OBJECT
33 Q_OBJECT
36 Q_INTERFACES(QDeclarativeParserStatus)
34 Q_INTERFACES(QDeclarativeParserStatus)
37 Q_PROPERTY(int count READ count NOTIFY countChanged)
35 Q_PROPERTY(int count READ count NOTIFY countChanged)
38 Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
36 Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
39 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
37 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
40
38
41 public:
39 public:
42 explicit DeclarativeScatterSeries(QObject *parent = 0);
40 explicit DeclarativeScatterSeries(QObject *parent = 0);
43 QXYSeries *xySeries();
41 QXYSeries *xySeries();
44 QDeclarativeListProperty<QObject> declarativeChildren();
42 QDeclarativeListProperty<QObject> declarativeChildren();
45
43
46 public: // from QDeclarativeParserStatus
44 public: // from QDeclarativeParserStatus
47 void classBegin() { DeclarativeXySeries::classBegin(); }
45 void classBegin() { DeclarativeXySeries::classBegin(); }
48 void componentComplete() { DeclarativeXySeries::componentComplete(); }
46 void componentComplete() { DeclarativeXySeries::componentComplete(); }
49
47
50 public:
48 public:
51 Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
49 Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
52 Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
50 Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
53 Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
51 Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
54 Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
52 Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
55 Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
53 Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
56 Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
54 Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
57
55
58 Q_SIGNALS:
56 Q_SIGNALS:
59 void countChanged(int count);
57 void countChanged(int count);
60
58
61 public Q_SLOTS:
59 public Q_SLOTS:
62 static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
60 static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
63 void handleCountChanged(int index);
61 void handleCountChanged(int index);
64 };
62 };
65
63
66 QTCOMMERCIALCHART_END_NAMESPACE
64 QTCOMMERCIALCHART_END_NAMESPACE
67
65
68 #endif // DECLARATIVESCATTERSERIES_H
66 #endif // DECLARATIVESCATTERSERIES_H
@@ -1,60 +1,57
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 "declarativesplineseries.h"
21 #include "declarativesplineseries.h"
22 #include "declarativechart.h"
23 #include <QChart>
24 #include "declarativexypoint.h"
25
22
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
23 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27
24
28 DeclarativeSplineSeries::DeclarativeSplineSeries(QObject *parent) :
25 DeclarativeSplineSeries::DeclarativeSplineSeries(QObject *parent) :
29 QSplineSeries(parent)
26 QSplineSeries(parent)
30 {
27 {
31 connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
28 connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
32 connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
29 connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
33 }
30 }
34
31
35 QXYSeries *DeclarativeSplineSeries::xySeries()
32 QXYSeries *DeclarativeSplineSeries::xySeries()
36 {
33 {
37 return this;
34 return this;
38 }
35 }
39
36
40 void DeclarativeSplineSeries::handleCountChanged(int index)
37 void DeclarativeSplineSeries::handleCountChanged(int index)
41 {
38 {
42 Q_UNUSED(index)
39 Q_UNUSED(index)
43 emit countChanged(points().count());
40 emit countChanged(points().count());
44 }
41 }
45
42
46 QDeclarativeListProperty<QObject> DeclarativeSplineSeries::declarativeChildren()
43 QDeclarativeListProperty<QObject> DeclarativeSplineSeries::declarativeChildren()
47 {
44 {
48 return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren);
45 return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren);
49 }
46 }
50
47
51 void DeclarativeSplineSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element)
48 void DeclarativeSplineSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element)
52 {
49 {
53 Q_UNUSED(list)
50 Q_UNUSED(list)
54 Q_UNUSED(element)
51 Q_UNUSED(element)
55 // Empty implementation, childs are parsed in componentComplete
52 // Empty implementation, childs are parsed in componentComplete
56 }
53 }
57
54
58 #include "moc_declarativesplineseries.cpp"
55 #include "moc_declarativesplineseries.cpp"
59
56
60 QTCOMMERCIALCHART_END_NAMESPACE
57 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,69 +1,66
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 DECLARATIVESPLINESERIES_H
21 #ifndef DECLARATIVESPLINESERIES_H
22 #define DECLARATIVESPLINESERIES_H
22 #define DECLARATIVESPLINESERIES_H
23
23
24 #include "qchartglobal.h"
25 #include "qsplineseries.h"
24 #include "qsplineseries.h"
26 #include "declarativexyseries.h"
25 #include "declarativexyseries.h"
27 #include "qabstractaxis.h"
28 #include <QDeclarativeParserStatus>
26 #include <QDeclarativeParserStatus>
29 #include <QDeclarativeListProperty>
27 #include <QDeclarativeListProperty>
30 #include <QDeclarativeParserStatus>
31
28
32 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
33
30
34 class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries, public QDeclarativeParserStatus
31 class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries, public QDeclarativeParserStatus
35 {
32 {
36 Q_OBJECT
33 Q_OBJECT
37 Q_INTERFACES(QDeclarativeParserStatus)
34 Q_INTERFACES(QDeclarativeParserStatus)
38 Q_PROPERTY(int count READ count NOTIFY countChanged)
35 Q_PROPERTY(int count READ count NOTIFY countChanged)
39 Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
36 Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
40 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
37 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
41
38
42 public:
39 public:
43 explicit DeclarativeSplineSeries(QObject *parent = 0);
40 explicit DeclarativeSplineSeries(QObject *parent = 0);
44 QXYSeries *xySeries();
41 QXYSeries *xySeries();
45 QDeclarativeListProperty<QObject> declarativeChildren();
42 QDeclarativeListProperty<QObject> declarativeChildren();
46
43
47 public: // from QDeclarativeParserStatus
44 public: // from QDeclarativeParserStatus
48 void classBegin() { DeclarativeXySeries::classBegin(); }
45 void classBegin() { DeclarativeXySeries::classBegin(); }
49 void componentComplete() { DeclarativeXySeries::componentComplete(); }
46 void componentComplete() { DeclarativeXySeries::componentComplete(); }
50
47
51 public:
48 public:
52 Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
49 Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
53 Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
50 Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
54 Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
51 Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
55 Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
52 Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
56 Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
53 Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
57 Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
54 Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
58
55
59 Q_SIGNALS:
56 Q_SIGNALS:
60 void countChanged(int count);
57 void countChanged(int count);
61
58
62 public Q_SLOTS:
59 public Q_SLOTS:
63 static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
60 static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
64 void handleCountChanged(int index);
61 void handleCountChanged(int index);
65 };
62 };
66
63
67 QTCOMMERCIALCHART_END_NAMESPACE
64 QTCOMMERCIALCHART_END_NAMESPACE
68
65
69 #endif // DECLARATIVESPLINESERIES_H
66 #endif // DECLARATIVESPLINESERIES_H
@@ -1,106 +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 //#include "DeclarativeXySeries.h"
21
22 #include "declarativexyseries.h"
22 #include "declarativexyseries.h"
23 #include "declarativechart.h"
24 #include <QXYSeries>
25 #include <QVXYModelMapper>
23 #include <QVXYModelMapper>
26 #include <QHXYModelMapper>
24 #include <QHXYModelMapper>
27 #include <QDeclarativeListProperty>
28
25
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30
27
31 DeclarativeXySeries::DeclarativeXySeries()
28 DeclarativeXySeries::DeclarativeXySeries()
32 {
29 {
33 }
30 }
34
31
35 DeclarativeXySeries::~DeclarativeXySeries()
32 DeclarativeXySeries::~DeclarativeXySeries()
36 {
33 {
37 }
34 }
38
35
39 void DeclarativeXySeries::classBegin()
36 void DeclarativeXySeries::classBegin()
40 {
37 {
41 }
38 }
42
39
43 void DeclarativeXySeries::componentComplete()
40 void DeclarativeXySeries::componentComplete()
44 {
41 {
45 QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
42 QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
46 Q_ASSERT(series);
43 Q_ASSERT(series);
47
44
48 foreach(QObject *child, series->children()) {
45 foreach(QObject *child, series->children()) {
49 if (qobject_cast<DeclarativeXYPoint *>(child)) {
46 if (qobject_cast<DeclarativeXYPoint *>(child)) {
50 DeclarativeXYPoint *point = qobject_cast<DeclarativeXYPoint *>(child);
47 DeclarativeXYPoint *point = qobject_cast<DeclarativeXYPoint *>(child);
51 series->append(point->x(), point->y());
48 series->append(point->x(), point->y());
52 } else if(qobject_cast<QVXYModelMapper *>(child)) {
49 } else if(qobject_cast<QVXYModelMapper *>(child)) {
53 QVXYModelMapper *mapper = qobject_cast<QVXYModelMapper *>(child);
50 QVXYModelMapper *mapper = qobject_cast<QVXYModelMapper *>(child);
54 mapper->setSeries(series);
51 mapper->setSeries(series);
55 } else if(qobject_cast<QHXYModelMapper *>(child)) {
52 } else if(qobject_cast<QHXYModelMapper *>(child)) {
56 QHXYModelMapper *mapper = qobject_cast<QHXYModelMapper *>(child);
53 QHXYModelMapper *mapper = qobject_cast<QHXYModelMapper *>(child);
57 mapper->setSeries(series);
54 mapper->setSeries(series);
58 }
55 }
59 }
56 }
60 }
57 }
61
58
62 void DeclarativeXySeries::append(qreal x, qreal y)
59 void DeclarativeXySeries::append(qreal x, qreal y)
63 {
60 {
64 QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
61 QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
65 Q_ASSERT(series);
62 Q_ASSERT(series);
66 series->append(x, y);
63 series->append(x, y);
67 }
64 }
68
65
69 void DeclarativeXySeries::replace(qreal oldX, qreal oldY, qreal newX, qreal newY)
66 void DeclarativeXySeries::replace(qreal oldX, qreal oldY, qreal newX, qreal newY)
70 {
67 {
71 QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
68 QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
72 Q_ASSERT(series);
69 Q_ASSERT(series);
73 series->replace(oldX, oldY, newX, newY);
70 series->replace(oldX, oldY, newX, newY);
74 }
71 }
75
72
76 void DeclarativeXySeries::remove(qreal x, qreal y)
73 void DeclarativeXySeries::remove(qreal x, qreal y)
77 {
74 {
78 QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
75 QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
79 Q_ASSERT(series);
76 Q_ASSERT(series);
80 series->remove(x, y);
77 series->remove(x, y);
81 }
78 }
82
79
83 void DeclarativeXySeries::insert(int index, qreal x, qreal y)
80 void DeclarativeXySeries::insert(int index, qreal x, qreal y)
84 {
81 {
85 QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
82 QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
86 Q_ASSERT(series);
83 Q_ASSERT(series);
87 series->insert(index, QPointF(x, y));
84 series->insert(index, QPointF(x, y));
88 }
85 }
89
86
90 void DeclarativeXySeries::clear()
87 void DeclarativeXySeries::clear()
91 {
88 {
92 QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
89 QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
93 Q_ASSERT(series);
90 Q_ASSERT(series);
94 series->clear();
91 series->clear();
95 }
92 }
96
93
97 QPointF DeclarativeXySeries::at(int index)
94 QPointF DeclarativeXySeries::at(int index)
98 {
95 {
99 QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
96 QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
100 Q_ASSERT(series);
97 Q_ASSERT(series);
101 if (index >= 0 || index < series->count())
98 if (index >= 0 || index < series->count())
102 return series->points().at(index);
99 return series->points().at(index);
103 return QPointF(0, 0);
100 return QPointF(0, 0);
104 }
101 }
105
102
106 QTCOMMERCIALCHART_END_NAMESPACE
103 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,55 +1,53
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 DECLARATIVE_XY_SERIES_H
21 #ifndef DECLARATIVE_XY_SERIES_H
22 #define DECLARATIVE_XY_SERIES_H
22 #define DECLARATIVE_XY_SERIES_H
23
23
24 #include "qchartglobal.h"
25 #include "declarativexypoint.h"
24 #include "declarativexypoint.h"
26 #include <QColor>
27 #include <QXYSeries>
25 #include <QXYSeries>
28
26
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30
28
31 class QChart;
29 class QChart;
32 class QAbstractSeries;
30 class QAbstractSeries;
33
31
34 class DeclarativeXySeries
32 class DeclarativeXySeries
35 {
33 {
36 public:
34 public:
37 explicit DeclarativeXySeries();
35 explicit DeclarativeXySeries();
38 ~DeclarativeXySeries();
36 ~DeclarativeXySeries();
39
37
40 public:
38 public:
41 void classBegin();
39 void classBegin();
42 void componentComplete();
40 void componentComplete();
43 virtual QXYSeries *xySeries() = 0;
41 virtual QXYSeries *xySeries() = 0;
44
42
45 void append(qreal x, qreal y);
43 void append(qreal x, qreal y);
46 void replace(qreal oldX, qreal oldY, qreal newX, qreal newY);
44 void replace(qreal oldX, qreal oldY, qreal newX, qreal newY);
47 void remove(qreal x, qreal y);
45 void remove(qreal x, qreal y);
48 void insert(int index, qreal x, qreal y);
46 void insert(int index, qreal x, qreal y);
49 void clear();
47 void clear();
50 QPointF at(int index);
48 QPointF at(int index);
51 };
49 };
52
50
53 QTCOMMERCIALCHART_END_NAMESPACE
51 QTCOMMERCIALCHART_END_NAMESPACE
54
52
55 #endif // DECLARATIVE_XY_SERIES_H
53 #endif // DECLARATIVE_XY_SERIES_H
@@ -1,104 +1,101
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 <QtDeclarative/qdeclarativeextensionplugin.h>
21 #include <QtDeclarative/qdeclarativeextensionplugin.h>
22 #include <QtDeclarative/qdeclarative.h>
22 #include <QtDeclarative/qdeclarative.h>
23 #include "qchart.h"
23 #include "qchart.h"
24 #include "qabstractaxis.h"
24 #include "qabstractaxis.h"
25 #include "qvaluesaxis.h"
25 #include "qvaluesaxis.h"
26 #include "qbarcategoriesaxis.h"
26 #include "qbarcategoriesaxis.h"
27 #include "declarativechart.h"
27 #include "declarativechart.h"
28 #include "declarativexypoint.h"
28 #include "declarativexypoint.h"
29 #include "declarativelineseries.h"
29 #include "declarativelineseries.h"
30 #include "declarativesplineseries.h"
30 #include "declarativesplineseries.h"
31 #include "declarativeareaseries.h"
31 #include "declarativeareaseries.h"
32 #include "declarativescatterseries.h"
32 #include "declarativescatterseries.h"
33 #include "declarativebarseries.h"
33 #include "declarativebarseries.h"
34 #include "declarativepieseries.h"
34 #include "declarativepieseries.h"
35 #include <QVXYModelMapper>
35 #include "qvxymodelmapper.h"
36 #include <QHXYModelMapper>
36 #include "qhxymodelmapper.h"
37 #include <QHPieModelMapper>
37 #include "qhpiemodelmapper.h"
38 #include <QVPieModelMapper>
38 #include "qvpiemodelmapper.h"
39 #include <QHBarModelMapper>
39 #include "qhbarmodelmapper.h"
40 #include <QVBarModelMapper>
40 #include "qvbarmodelmapper.h"
41 #include <QAbstractItemModel>
41
42
42 QTCOMMERCIALCHART_BEGIN_NAMESPACE
43 QTCOMMERCIALCHART_BEGIN_NAMESPACE
43
44
44 class ChartQmlPlugin : public QDeclarativeExtensionPlugin
45 class ChartQmlPlugin : public QDeclarativeExtensionPlugin
45 {
46 {
46 Q_OBJECT
47 Q_OBJECT
47 public:
48 public:
48 virtual void registerTypes(const char *uri)
49 virtual void registerTypes(const char *uri)
49 {
50 {
50 Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart"));
51 Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart"));
51
52
52 qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView");
53 qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView");
53 qmlRegisterType<DeclarativeXYPoint>(uri, 1, 0, "XYPoint");
54 qmlRegisterType<DeclarativeXYPoint>(uri, 1, 0, "XYPoint");
54 qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries");
55 qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries");
55 qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries");
56 qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries");
56 qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries");
57 qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries");
57 qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries");
58 qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries");
58 qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries");
59 qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries");
59 qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries");
60 qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries");
60 qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries");
61 qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries");
61 qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries");
62 qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries");
62 qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice");
63 qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice");
63 qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet");
64 qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet");
64 qmlRegisterType<QHXYModelMapper>(uri, 1, 0, "HXYModelMapper");
65 qmlRegisterType<QHXYModelMapper>(uri, 1, 0, "HXYModelMapper");
65 qmlRegisterType<QVXYModelMapper>(uri, 1, 0, "VXYModelMapper");
66 qmlRegisterType<QVXYModelMapper>(uri, 1, 0, "VXYModelMapper");
66 qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper");
67 qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper");
67 qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper");
68 qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper");
68 qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper");
69 qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper");
69 qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper");
70 qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper");
70 qmlRegisterType<QValuesAxis>(uri, 1, 0, "ValuesAxis");
71 qmlRegisterType<QValuesAxis>(uri, 1, 0, "ValuesAxis");
71 qmlRegisterType<QBarCategoriesAxis>(uri, 1, 0, "BarCategoriesAxis");
72 qmlRegisterType<QBarCategoriesAxis>(uri, 1, 0, "BarCategoriesAxis");
72
73
73 qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend",
74 qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend",
74 QLatin1String("Trying to create uncreatable: Legend."));
75 QLatin1String("Trying to create uncreatable: Legend."));
75 qmlRegisterUncreatableType<QXYSeries>(uri, 1, 0, "XYSeries",
76 qmlRegisterUncreatableType<QXYSeries>(uri, 1, 0, "XYSeries",
76 QLatin1String("Trying to create uncreatable: XYSeries."));
77 QLatin1String("Trying to create uncreatable: XYSeries."));
77 qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel",
78 qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel",
78 QLatin1String("Trying to create uncreatable: AbstractItemModel."));
79 QLatin1String("Trying to create uncreatable: AbstractItemModel."));
79 qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper",
80 qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper",
80 QLatin1String("Trying to create uncreatable: XYModelMapper."));
81 QLatin1String("Trying to create uncreatable: XYModelMapper."));
81 qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper",
82 qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper",
82 QLatin1String("Trying to create uncreatable: PieModelMapper."));
83 QLatin1String("Trying to create uncreatable: PieModelMapper."));
83 qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 0, "BarModelMapper",
84 qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 0, "BarModelMapper",
84 QLatin1String("Trying to create uncreatable: BarModelMapper."));
85 QLatin1String("Trying to create uncreatable: BarModelMapper."));
85 qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries",
86 qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries",
86 QLatin1String("Trying to create uncreatable: AbstractSeries."));
87 QLatin1String("Trying to create uncreatable: AbstractSeries."));
87 qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 0, "AbstractBarSeries",
88 qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 0, "AbstractBarSeries",
88 QLatin1String("Trying to create uncreatable: AbstractBarSeries."));
89 QLatin1String("Trying to create uncreatable: AbstractBarSeries."));
89 qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 0, "AbstractAxis",
90 qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 0, "AbstractAxis",
90 QLatin1String("Trying to create uncreatable: AbstractAxis."));
91 QLatin1String("Trying to create uncreatable: AbstractAxis."));
91 qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper",
92 QLatin1String("Trying to create uncreatable: PieModelMapper."));
93 qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper",
94 QLatin1String("Trying to create uncreatable: XYModelMapper."));
95 }
92 }
96 };
93 };
97
94
98 #include "plugin.moc"
95 #include "plugin.moc"
99
96
100 QTCOMMERCIALCHART_END_NAMESPACE
97 QTCOMMERCIALCHART_END_NAMESPACE
101
98
102 QTCOMMERCIALCHART_USE_NAMESPACE
99 QTCOMMERCIALCHART_USE_NAMESPACE
103
100
104 Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin))
101 Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin))
General Comments 0
You need to be logged in to leave comments. Login now