##// END OF EJS Templates
Clears the qml plugin code from legacy code
Michal Klocek -
r1608:f0863591c53c
parent child
Show More
@@ -1,160 +1,155
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 import QtQuick 1.0
21 import QtQuick 1.0
22 import QtCommercial.Chart 1.0
22 import QtCommercial.Chart 1.0
23 import QmlCustomModel 1.0
23 import QmlCustomModel 1.0
24
24
25 Rectangle {
25 Rectangle {
26 anchors.fill: parent
26 anchors.fill: parent
27
27
28 //![1]
28 //![1]
29 ChartView {
29 ChartView {
30 id: chartView
30 id: chartView
31 title: "Top-5 car brand shares in Finland"
31 title: "Top-5 car brand shares in Finland"
32 anchors.fill: parent
32 anchors.fill: parent
33 animationOptions: ChartView.SeriesAnimations
33 animationOptions: ChartView.SeriesAnimations
34
34 CategoriesAxis {
35 CategoriesAxis {
35 id: categoryAxis
36 id: categoryAxis
36 categories: ["2007", "2008", "2009", "2010", "2011", "2012" ]
37 categories: ["2007", "2008", "2009", "2010", "2011", "2012" ]
37 }
38 }
38 // ...
39 // ...
39 //![1]
40 //![1]
40
41
41 //![2]
42 //![2]
42 CustomModel {
43 CustomModel {
43 id: customModel
44 id: customModel
44 verticalHeaders: ["Manufacturer", "Volkswagen", "Toyota", "Ford", "Skoda", "Volvo", "Others"]
45 verticalHeaders: ["Manufacturer", "Volkswagen", "Toyota", "Ford", "Skoda", "Volvo", "Others"]
45 CustomModelElement { values: [0, "Manufacturer", 0, 1, 2, 3, 4] }
46 CustomModelElement { values: [0, "Manufacturer", 0, 1, 2, 3, 4] }
46 CustomModelElement { values: [1, "Volkswagen", 10.3, 12.0, 12.8, 13.0, 13.8] }
47 CustomModelElement { values: [1, "Volkswagen", 10.3, 12.0, 12.8, 13.0, 13.8] }
47 CustomModelElement { values: [2, "Toyota", 13.8, 13.5, 16.2, 13.7, 10.7] }
48 CustomModelElement { values: [2, "Toyota", 13.8, 13.5, 16.2, 13.7, 10.7] }
48 CustomModelElement { values: [3, "Ford", 6.4, 7.1, 8.9, 8.2, 8.6] }
49 CustomModelElement { values: [3, "Ford", 6.4, 7.1, 8.9, 8.2, 8.6] }
49 CustomModelElement { values: [4, "Skoda", 4.7, 5.8, 6.9, 8.3, 8.2] }
50 CustomModelElement { values: [4, "Skoda", 4.7, 5.8, 6.9, 8.3, 8.2] }
50 CustomModelElement { values: [5, "Volvo", 7.1, 6.7, 6.5, 6.3, 7.0] }
51 CustomModelElement { values: [5, "Volvo", 7.1, 6.7, 6.5, 6.3, 7.0] }
51 CustomModelElement { values: [6, "Others", 57.7, 54.9, 48.7, 50.5, 51.7] }
52 CustomModelElement { values: [6, "Others", 57.7, 54.9, 48.7, 50.5, 51.7] }
52 }
53 }
53 //![2]
54 //![2]
54
55
55 //![5]
56 //![5]
56 BarSeries {
57 BarSeries {
57 name: "Others"
58 name: "Others"
58 barWidth: 0.9
59 barWidth: 0.9
59 visible: false
60 visible: false
60 axisX: categoryAxis
61 HBarModelMapper {
61 HBarModelMapper {
62 model: customModel
62 model: customModel
63 firstBarSetRow: 6
63 firstBarSetRow: 6
64 lastBarSetRow: 6
64 lastBarSetRow: 6
65 firstColumn: 2
65 firstColumn: 2
66 }
66 }
67 }
67 }
68 //![5]
68 //![5]
69
69
70 //![4]
70 //![4]
71 LineSeries {
71 LineSeries {
72 name: "Volkswagen"
72 name: "Volkswagen"
73 axisX: categoryAxis
74 visible: false
73 visible: false
75 HXYModelMapper {
74 HXYModelMapper {
76 model: customModel
75 model: customModel
77 xRow: 0
76 xRow: 0
78 yRow: 1
77 yRow: 1
79 firstColumn: 2
78 firstColumn: 2
80 }
79 }
81 }
80 }
82 //![4]
81 //![4]
83
82
84 LineSeries {
83 LineSeries {
85 name: "Toyota"
84 name: "Toyota"
86 axisX: categoryAxis
87 visible: false
85 visible: false
88 HXYModelMapper {
86 HXYModelMapper {
89 model: customModel
87 model: customModel
90 xRow: 0
88 xRow: 0
91 yRow: 2
89 yRow: 2
92 firstColumn: 2
90 firstColumn: 2
93 }
91 }
94 }
92 }
95
93
96 LineSeries {
94 LineSeries {
97 name: "Ford"
95 name: "Ford"
98 axisX: categoryAxis
99 visible: false
96 visible: false
100 HXYModelMapper {
97 HXYModelMapper {
101 model: customModel
98 model: customModel
102 xRow: 0
99 xRow: 0
103 yRow: 3
100 yRow: 3
104 firstColumn: 2
101 firstColumn: 2
105 }
102 }
106 }
103 }
107
104
108 LineSeries {
105 LineSeries {
109 name: "Skoda"
106 name: "Skoda"
110 axisX: categoryAxis
111 visible: false
107 visible: false
112 HXYModelMapper {
108 HXYModelMapper {
113 model: customModel
109 model: customModel
114 xRow: 0
110 xRow: 0
115 yRow: 4
111 yRow: 4
116 firstColumn: 2
112 firstColumn: 2
117 }
113 }
118 }
114 }
119
115
120 LineSeries {
116 LineSeries {
121 name: "Volvo"
117 name: "Volvo"
122 axisX: categoryAxis
123 visible: false
118 visible: false
124 HXYModelMapper {
119 HXYModelMapper {
125 model: customModel
120 model: customModel
126 xRow: 0
121 xRow: 0
127 yRow: 5
122 yRow: 5
128 firstColumn: 2
123 firstColumn: 2
129 }
124 }
130 }
125 }
131
126
132 //![3]
127 //![3]
133 PieSeries {
128 PieSeries {
134 id: pieSeries
129 id: pieSeries
135 size: 0.4
130 size: 0.4
136 horizontalPosition: 0.7
131 horizontalPosition: 0.7
137 verticalPosition: 0.4
132 verticalPosition: 0.4
138 onClicked: {
133 onClicked: {
139 // Show the selection by exploding the slice
134 // Show the selection by exploding the slice
140 slice.exploded = !slice.exploded;
135 slice.exploded = !slice.exploded;
141
136
142 // Update the line series to show the yearly data for this slice
137 // Update the line series to show the yearly data for this slice
143 for (var i = 0; i < chartView.count; i++) {
138 for (var i = 0; i < chartView.count; i++) {
144 if (chartView.series(i).name == slice.label) {
139 if (chartView.series(i).name == slice.label) {
145 chartView.series(i).visible = slice.exploded;
140 chartView.series(i).visible = slice.exploded;
146 }
141 }
147 }
142 }
148 }
143 }
149 }
144 }
150 //![3]
145 //![3]
151
146
152 VPieModelMapper {
147 VPieModelMapper {
153 series: pieSeries
148 series: pieSeries
154 model: customModel
149 model: customModel
155 labelsColumn: 1
150 labelsColumn: 1
156 valuesColumn: 2
151 valuesColumn: 2
157 firstRow: 1
152 firstRow: 1
158 }
153 }
159 }
154 }
160 }
155 }
@@ -1,75 +1,56
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"
22 #include "declarativechart.h"
23 #include "qchart.h"
23 #include "qchart.h"
24 #include "qxymodelmapper.h"
24 #include "qxymodelmapper.h"
25
25
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27
27
28 DeclarativeAreaSeries::DeclarativeAreaSeries(QObject *parent) :
28 DeclarativeAreaSeries::DeclarativeAreaSeries(QObject *parent) :
29 QAreaSeries(parent)
29 QAreaSeries(parent)
30 {
30 {
31 }
31 }
32
32
33 void DeclarativeAreaSeries::setAxisX(QAbstractAxis *axis)
34 {
35 chart()->setAxisX(axis,this);
36 }
37
38 QAbstractAxis *DeclarativeAreaSeries::axisX()
39 {
40 return chart()->axisX(this);
41 }
42
43 void DeclarativeAreaSeries::setAxisY(QAbstractAxis *axis)
44 {
45 chart()->setAxisY(axis,this);
46 }
47
48 QAbstractAxis *DeclarativeAreaSeries::axisY()
49 {
50 return chart()->axisY(this);
51 }
52
33
53 void DeclarativeAreaSeries::setUpperSeries(DeclarativeLineSeries* series)
34 void DeclarativeAreaSeries::setUpperSeries(DeclarativeLineSeries* series)
54 {
35 {
55 QAreaSeries::setUpperSeries(series);
36 QAreaSeries::setUpperSeries(series);
56 }
37 }
57
38
58 DeclarativeLineSeries* DeclarativeAreaSeries::upperSeries() const
39 DeclarativeLineSeries* DeclarativeAreaSeries::upperSeries() const
59 {
40 {
60 return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::upperSeries());
41 return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::upperSeries());
61 }
42 }
62
43
63 void DeclarativeAreaSeries::setLowerSeries(DeclarativeLineSeries* series)
44 void DeclarativeAreaSeries::setLowerSeries(DeclarativeLineSeries* series)
64 {
45 {
65 QAreaSeries::setLowerSeries(series);
46 QAreaSeries::setLowerSeries(series);
66 }
47 }
67
48
68 DeclarativeLineSeries* DeclarativeAreaSeries::lowerSeries() const
49 DeclarativeLineSeries* DeclarativeAreaSeries::lowerSeries() const
69 {
50 {
70 return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::lowerSeries());
51 return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::lowerSeries());
71 }
52 }
72
53
73 #include "moc_declarativeareaseries.cpp"
54 #include "moc_declarativeareaseries.cpp"
74
55
75 QTCOMMERCIALCHART_END_NAMESPACE
56 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,53 +1,47
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"
24 #include "qchartglobal.h"
25 #include "qareaseries.h"
25 #include "qareaseries.h"
26 #include "declarativelineseries.h"
26 #include "declarativelineseries.h"
27 #include "qabstractaxis.h"
27 #include "qabstractaxis.h"
28
28
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30
30
31 class DeclarativeAreaSeries : public QAreaSeries
31 class DeclarativeAreaSeries : public QAreaSeries
32 {
32 {
33 Q_OBJECT
33 Q_OBJECT
34 Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX)
35 Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY)
36 Q_PROPERTY(DeclarativeLineSeries *upperSeries READ upperSeries WRITE setUpperSeries)
34 Q_PROPERTY(DeclarativeLineSeries *upperSeries READ upperSeries WRITE setUpperSeries)
37 Q_PROPERTY(DeclarativeLineSeries *lowerSeries READ lowerSeries WRITE setLowerSeries)
35 Q_PROPERTY(DeclarativeLineSeries *lowerSeries READ lowerSeries WRITE setLowerSeries)
38
36
39 public:
37 public:
40 void setAxisX(QAbstractAxis *axis);
41 QAbstractAxis *axisX();
42 void setAxisY(QAbstractAxis *axis);
43 QAbstractAxis *axisY();
44 explicit DeclarativeAreaSeries(QObject *parent = 0);
38 explicit DeclarativeAreaSeries(QObject *parent = 0);
45 void setUpperSeries(DeclarativeLineSeries* series);
39 void setUpperSeries(DeclarativeLineSeries* series);
46 DeclarativeLineSeries* upperSeries() const;
40 DeclarativeLineSeries* upperSeries() const;
47 void setLowerSeries(DeclarativeLineSeries* series);
41 void setLowerSeries(DeclarativeLineSeries* series);
48 DeclarativeLineSeries* lowerSeries() const;
42 DeclarativeLineSeries* lowerSeries() const;
49 };
43 };
50
44
51 QTCOMMERCIALCHART_END_NAMESPACE
45 QTCOMMERCIALCHART_END_NAMESPACE
52
46
53 #endif // DECLARATIVEAREASERIES_H
47 #endif // DECLARATIVEAREASERIES_H
@@ -1,145 +1,141
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"
24 #include "qchartglobal.h"
25 #include "qabstractbarseries.h"
25 #include "qabstractbarseries.h"
26 #include "qbarseries.h"
26 #include "qbarseries.h"
27 #include "qstackedbarseries.h"
27 #include "qstackedbarseries.h"
28 #include "qpercentbarseries.h"
28 #include "qpercentbarseries.h"
29 #include "qbarset.h"
29 #include "qbarset.h"
30 #include "qabstractaxis.h"
30 #include "qabstractaxis.h"
31 #include <QDeclarativeItem>
31 #include <QDeclarativeItem>
32 #include <QDeclarativeParserStatus>
32 #include <QDeclarativeParserStatus>
33
33
34 QTCOMMERCIALCHART_BEGIN_NAMESPACE
34 QTCOMMERCIALCHART_BEGIN_NAMESPACE
35
35
36 class QChart;
36 class QChart;
37
37
38 class DeclarativeBarSet : public QBarSet
38 class DeclarativeBarSet : public QBarSet
39 {
39 {
40 Q_OBJECT
40 Q_OBJECT
41 Q_PROPERTY(QVariantList values READ values WRITE setValues)
41 Q_PROPERTY(QVariantList values READ values WRITE setValues)
42 Q_PROPERTY(int count READ count NOTIFY countChanged)
42 Q_PROPERTY(int count READ count NOTIFY countChanged)
43
43
44 public:
44 public:
45 explicit DeclarativeBarSet(QObject *parent = 0);
45 explicit DeclarativeBarSet(QObject *parent = 0);
46 QVariantList values();
46 QVariantList values();
47 void setValues(QVariantList values);
47 void setValues(QVariantList values);
48
48
49 public: // From QBarSet
49 public: // From QBarSet
50 Q_INVOKABLE void append(qreal value) { QBarSet::append(value); }
50 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); }
51 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); }
52 Q_INVOKABLE void replace(int index, qreal value) { QBarSet::replace(index, value); }
53 Q_INVOKABLE qreal at(int index) { return QBarSet::at(index); }
53 Q_INVOKABLE qreal at(int index) { return QBarSet::at(index); }
54
54
55 Q_SIGNALS:
55 Q_SIGNALS:
56 void countChanged(int count);
56 void countChanged(int count);
57
57
58 private Q_SLOTS:
58 private Q_SLOTS:
59 void handleCountChanged(int index, int count);
59 void handleCountChanged(int index, int count);
60 };
60 };
61
61
62 class DeclarativeBarSeries : public QBarSeries, public QDeclarativeParserStatus
62 class DeclarativeBarSeries : public QBarSeries, public QDeclarativeParserStatus
63 {
63 {
64 Q_OBJECT
64 Q_OBJECT
65 Q_INTERFACES(QDeclarativeParserStatus)
65 Q_INTERFACES(QDeclarativeParserStatus)
66 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
66 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
67 Q_CLASSINFO("DefaultProperty", "seriesChildren")
67 Q_CLASSINFO("DefaultProperty", "seriesChildren")
68
68
69 public:
69 public:
70 explicit DeclarativeBarSeries(QDeclarativeItem *parent = 0);
70 explicit DeclarativeBarSeries(QDeclarativeItem *parent = 0);
71 void setAxisX(QAbstractAxis *axis);
72 QAbstractAxis *axisX();
73 void setAxisY(QAbstractAxis *axis);
74 QAbstractAxis *axisY();
75 QDeclarativeListProperty<QObject> seriesChildren();
71 QDeclarativeListProperty<QObject> seriesChildren();
76 Q_INVOKABLE DeclarativeBarSet *at(int index);
72 Q_INVOKABLE DeclarativeBarSet *at(int index);
77 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
73 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
78 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
74 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
79 Q_INVOKABLE bool remove(QBarSet *barset) { return QBarSeries::remove(barset); }
75 Q_INVOKABLE bool remove(QBarSet *barset) { return QBarSeries::remove(barset); }
80 Q_INVOKABLE void clear() { return QBarSeries::clear(); }
76 Q_INVOKABLE void clear() { return QBarSeries::clear(); }
81
77
82 public: // from QDeclarativeParserStatus
78 public: // from QDeclarativeParserStatus
83 void classBegin();
79 void classBegin();
84 void componentComplete();
80 void componentComplete();
85
81
86 public Q_SLOTS:
82 public Q_SLOTS:
87 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
83 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
88
84
89 private:
85 private:
90 QAbstractAxis* m_axisX;
86 QAbstractAxis* m_axisX;
91 QAbstractAxis* m_axisY;
87 QAbstractAxis* m_axisY;
92 };
88 };
93
89
94 class DeclarativeStackedBarSeries : public QStackedBarSeries, public QDeclarativeParserStatus
90 class DeclarativeStackedBarSeries : public QStackedBarSeries, public QDeclarativeParserStatus
95 {
91 {
96 Q_OBJECT
92 Q_OBJECT
97 Q_INTERFACES(QDeclarativeParserStatus)
93 Q_INTERFACES(QDeclarativeParserStatus)
98 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
94 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
99 Q_CLASSINFO("DefaultProperty", "seriesChildren")
95 Q_CLASSINFO("DefaultProperty", "seriesChildren")
100
96
101 public:
97 public:
102 explicit DeclarativeStackedBarSeries(QDeclarativeItem *parent = 0);
98 explicit DeclarativeStackedBarSeries(QDeclarativeItem *parent = 0);
103 QDeclarativeListProperty<QObject> seriesChildren();
99 QDeclarativeListProperty<QObject> seriesChildren();
104 Q_INVOKABLE DeclarativeBarSet *at(int index);
100 Q_INVOKABLE DeclarativeBarSet *at(int index);
105 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
101 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
106 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
102 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
107 Q_INVOKABLE bool remove(QBarSet *barset) { return QStackedBarSeries::remove(barset); }
103 Q_INVOKABLE bool remove(QBarSet *barset) { return QStackedBarSeries::remove(barset); }
108 Q_INVOKABLE void clear() { return QStackedBarSeries::clear(); }
104 Q_INVOKABLE void clear() { return QStackedBarSeries::clear(); }
109
105
110 public: // from QDeclarativeParserStatus
106 public: // from QDeclarativeParserStatus
111 void classBegin();
107 void classBegin();
112 void componentComplete();
108 void componentComplete();
113
109
114 public Q_SLOTS:
110 public Q_SLOTS:
115 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
111 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
116
112
117 };
113 };
118
114
119 class DeclarativePercentBarSeries : public QPercentBarSeries, public QDeclarativeParserStatus
115 class DeclarativePercentBarSeries : public QPercentBarSeries, public QDeclarativeParserStatus
120 {
116 {
121 Q_OBJECT
117 Q_OBJECT
122 Q_INTERFACES(QDeclarativeParserStatus)
118 Q_INTERFACES(QDeclarativeParserStatus)
123 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
119 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
124 Q_CLASSINFO("DefaultProperty", "seriesChildren")
120 Q_CLASSINFO("DefaultProperty", "seriesChildren")
125
121
126 public:
122 public:
127 explicit DeclarativePercentBarSeries(QDeclarativeItem *parent = 0);
123 explicit DeclarativePercentBarSeries(QDeclarativeItem *parent = 0);
128 QDeclarativeListProperty<QObject> seriesChildren();
124 QDeclarativeListProperty<QObject> seriesChildren();
129 Q_INVOKABLE DeclarativeBarSet *at(int index);
125 Q_INVOKABLE DeclarativeBarSet *at(int index);
130 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
126 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
131 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
127 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
132 Q_INVOKABLE bool remove(QBarSet *barset) { return QPercentBarSeries::remove(barset); }
128 Q_INVOKABLE bool remove(QBarSet *barset) { return QPercentBarSeries::remove(barset); }
133 Q_INVOKABLE void clear() { return QPercentBarSeries::clear(); }
129 Q_INVOKABLE void clear() { return QPercentBarSeries::clear(); }
134
130
135 public: // from QDeclarativeParserStatus
131 public: // from QDeclarativeParserStatus
136 void classBegin();
132 void classBegin();
137 void componentComplete();
133 void componentComplete();
138
134
139 public Q_SLOTS:
135 public Q_SLOTS:
140 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
136 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
141 };
137 };
142
138
143 QTCOMMERCIALCHART_END_NAMESPACE
139 QTCOMMERCIALCHART_END_NAMESPACE
144
140
145 #endif // DECLARATIVEBARSERIES_H
141 #endif // DECLARATIVEBARSERIES_H
@@ -1,80 +1,60
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"
22 #include "declarativechart.h"
23 #include "qchart.h"
23 #include "qchart.h"
24 #include "qlineseries.h"
24 #include "qlineseries.h"
25
25
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27
27
28 DeclarativeLineSeries::DeclarativeLineSeries(QObject *parent) :
28 DeclarativeLineSeries::DeclarativeLineSeries(QObject *parent) :
29 QLineSeries(parent)
29 QLineSeries(parent)
30 {
30 {
31 connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
31 connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
32 connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
32 connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
33 }
33 }
34
34
35 QXYSeries *DeclarativeLineSeries::xySeries()
35 QXYSeries *DeclarativeLineSeries::xySeries()
36 {
36 {
37 return this;
37 return this;
38 }
38 }
39
39
40 void DeclarativeLineSeries::setAxisX(QAbstractAxis *axis)
41 {
42 chart()->setAxisX(axis,this);
43 }
44
45 QAbstractAxis *DeclarativeLineSeries::axisX()
46 {
47 return chart()->axisX(this);
48 }
49
50 void DeclarativeLineSeries::setAxisY(QAbstractAxis *axis)
51 {
52 chart()->setAxisY(axis,this);
53 }
54
55 QAbstractAxis *DeclarativeLineSeries::axisY()
56 {
57 return chart()->axisY(this);
58 }
59
60 void DeclarativeLineSeries::handleCountChanged(int index)
40 void DeclarativeLineSeries::handleCountChanged(int index)
61 {
41 {
62 Q_UNUSED(index)
42 Q_UNUSED(index)
63 emit countChanged(points().count());
43 emit countChanged(points().count());
64 }
44 }
65
45
66 QDeclarativeListProperty<QObject> DeclarativeLineSeries::declarativeChildren()
46 QDeclarativeListProperty<QObject> DeclarativeLineSeries::declarativeChildren()
67 {
47 {
68 return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren);
48 return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren);
69 }
49 }
70
50
71 void DeclarativeLineSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element)
51 void DeclarativeLineSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element)
72 {
52 {
73 Q_UNUSED(list)
53 Q_UNUSED(list)
74 Q_UNUSED(element)
54 Q_UNUSED(element)
75 // Empty implementation, childs are parsed in componentComplete
55 // Empty implementation, childs are parsed in componentComplete
76 }
56 }
77
57
78 #include "moc_declarativelineseries.cpp"
58 #include "moc_declarativelineseries.cpp"
79
59
80 QTCOMMERCIALCHART_END_NAMESPACE
60 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,75 +1,69
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"
24 #include "qchartglobal.h"
25 #include "qlineseries.h"
25 #include "qlineseries.h"
26 #include "declarativexyseries.h"
26 #include "declarativexyseries.h"
27 #include "qabstractaxis.h"
27 #include "qabstractaxis.h"
28 #include <QDeclarativeParserStatus>
28 #include <QDeclarativeParserStatus>
29 #include <QDeclarativeListProperty>
29 #include <QDeclarativeListProperty>
30 #include <QDeclarativeParserStatus>
30 #include <QDeclarativeParserStatus>
31
31
32 QTCOMMERCIALCHART_BEGIN_NAMESPACE
32 QTCOMMERCIALCHART_BEGIN_NAMESPACE
33
33
34 class DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries, public QDeclarativeParserStatus
34 class DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries, public QDeclarativeParserStatus
35 {
35 {
36 Q_OBJECT
36 Q_OBJECT
37 Q_INTERFACES(QDeclarativeParserStatus)
37 Q_INTERFACES(QDeclarativeParserStatus)
38 Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX)
39 Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY)
40 Q_PROPERTY(int count READ count NOTIFY countChanged)
38 Q_PROPERTY(int count READ count NOTIFY countChanged)
41 Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
39 Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
42 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
40 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
43
41
44 public:
42 public:
45 explicit DeclarativeLineSeries(QObject *parent = 0);
43 explicit DeclarativeLineSeries(QObject *parent = 0);
46 QXYSeries *xySeries();
44 QXYSeries *xySeries();
47 void setAxisX(QAbstractAxis *axis);
48 QAbstractAxis *axisX();
49 void setAxisY(QAbstractAxis *axis);
50 QAbstractAxis *axisY();
51 QDeclarativeListProperty<QObject> declarativeChildren();
45 QDeclarativeListProperty<QObject> declarativeChildren();
52
46
53 public: // from QDeclarativeParserStatus
47 public: // from QDeclarativeParserStatus
54 void classBegin() { DeclarativeXySeries::classBegin(); }
48 void classBegin() { DeclarativeXySeries::classBegin(); }
55 void componentComplete() { DeclarativeXySeries::componentComplete(); }
49 void componentComplete() { DeclarativeXySeries::componentComplete(); }
56
50
57 public:
51 public:
58 Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
52 Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
59 Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
53 Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
60 Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
54 Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
61 Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
55 Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
62 Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
56 Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
63 Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
57 Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
64
58
65 Q_SIGNALS:
59 Q_SIGNALS:
66 void countChanged(int count);
60 void countChanged(int count);
67
61
68 public Q_SLOTS:
62 public Q_SLOTS:
69 static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
63 static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
70 void handleCountChanged(int index);
64 void handleCountChanged(int index);
71 };
65 };
72
66
73 QTCOMMERCIALCHART_END_NAMESPACE
67 QTCOMMERCIALCHART_END_NAMESPACE
74
68
75 #endif // DECLARATIVELINESERIES_H
69 #endif // DECLARATIVELINESERIES_H
@@ -1,80 +1,60
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"
22 #include "declarativechart.h"
23 #include "qchart.h"
23 #include "qchart.h"
24 #include "qscatterseries.h"
24 #include "qscatterseries.h"
25
25
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27
27
28 DeclarativeScatterSeries::DeclarativeScatterSeries(QObject *parent) :
28 DeclarativeScatterSeries::DeclarativeScatterSeries(QObject *parent) :
29 QScatterSeries(parent)
29 QScatterSeries(parent)
30 {
30 {
31 connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
31 connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
32 connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
32 connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
33 }
33 }
34
34
35 QXYSeries *DeclarativeScatterSeries::xySeries()
35 QXYSeries *DeclarativeScatterSeries::xySeries()
36 {
36 {
37 return this;
37 return this;
38 }
38 }
39
39
40 void DeclarativeScatterSeries::setAxisX(QAbstractAxis *axis)
41 {
42 chart()->setAxisX(axis,this);
43 }
44
45 QAbstractAxis *DeclarativeScatterSeries::axisX()
46 {
47 return chart()->axisX(this);
48 }
49
50 void DeclarativeScatterSeries::setAxisY(QAbstractAxis *axis)
51 {
52 chart()->setAxisY(axis,this);
53 }
54
55 QAbstractAxis *DeclarativeScatterSeries::axisY()
56 {
57 return chart()->axisY(this);
58 }
59
60 void DeclarativeScatterSeries::handleCountChanged(int index)
40 void DeclarativeScatterSeries::handleCountChanged(int index)
61 {
41 {
62 Q_UNUSED(index)
42 Q_UNUSED(index)
63 emit countChanged(QScatterSeries::count());
43 emit countChanged(QScatterSeries::count());
64 }
44 }
65
45
66 QDeclarativeListProperty<QObject> DeclarativeScatterSeries::declarativeChildren()
46 QDeclarativeListProperty<QObject> DeclarativeScatterSeries::declarativeChildren()
67 {
47 {
68 return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren);
48 return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren);
69 }
49 }
70
50
71 void DeclarativeScatterSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element)
51 void DeclarativeScatterSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element)
72 {
52 {
73 Q_UNUSED(list)
53 Q_UNUSED(list)
74 Q_UNUSED(element)
54 Q_UNUSED(element)
75 // Empty implementation, childs are parsed in componentComplete
55 // Empty implementation, childs are parsed in componentComplete
76 }
56 }
77
57
78 #include "moc_declarativescatterseries.cpp"
58 #include "moc_declarativescatterseries.cpp"
79
59
80 QTCOMMERCIALCHART_END_NAMESPACE
60 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,74 +1,68
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"
24 #include "qchartglobal.h"
25 #include "qscatterseries.h"
25 #include "qscatterseries.h"
26 #include "declarativexyseries.h"
26 #include "declarativexyseries.h"
27 #include "qabstractaxis.h"
27 #include "qabstractaxis.h"
28 #include <QDeclarativeListProperty>
28 #include <QDeclarativeListProperty>
29 #include <QDeclarativeParserStatus>
29 #include <QDeclarativeParserStatus>
30
30
31 QTCOMMERCIALCHART_BEGIN_NAMESPACE
31 QTCOMMERCIALCHART_BEGIN_NAMESPACE
32
32
33 class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries, public QDeclarativeParserStatus
33 class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries, public QDeclarativeParserStatus
34 {
34 {
35 Q_OBJECT
35 Q_OBJECT
36 Q_INTERFACES(QDeclarativeParserStatus)
36 Q_INTERFACES(QDeclarativeParserStatus)
37 Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX)
38 Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY)
39 Q_PROPERTY(int count READ count NOTIFY countChanged)
37 Q_PROPERTY(int count READ count NOTIFY countChanged)
40 Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
38 Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
41 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
39 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
42
40
43 public:
41 public:
44 explicit DeclarativeScatterSeries(QObject *parent = 0);
42 explicit DeclarativeScatterSeries(QObject *parent = 0);
45 QXYSeries *xySeries();
43 QXYSeries *xySeries();
46 void setAxisX(QAbstractAxis *axis);
47 QAbstractAxis *axisX();
48 void setAxisY(QAbstractAxis *axis);
49 QAbstractAxis *axisY();
50 QDeclarativeListProperty<QObject> declarativeChildren();
44 QDeclarativeListProperty<QObject> declarativeChildren();
51
45
52 public: // from QDeclarativeParserStatus
46 public: // from QDeclarativeParserStatus
53 void classBegin() { DeclarativeXySeries::classBegin(); }
47 void classBegin() { DeclarativeXySeries::classBegin(); }
54 void componentComplete() { DeclarativeXySeries::componentComplete(); }
48 void componentComplete() { DeclarativeXySeries::componentComplete(); }
55
49
56 public:
50 public:
57 Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
51 Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
58 Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
52 Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
59 Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
53 Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
60 Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
54 Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
61 Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
55 Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
62 Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
56 Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
63
57
64 Q_SIGNALS:
58 Q_SIGNALS:
65 void countChanged(int count);
59 void countChanged(int count);
66
60
67 public Q_SLOTS:
61 public Q_SLOTS:
68 static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
62 static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
69 void handleCountChanged(int index);
63 void handleCountChanged(int index);
70 };
64 };
71
65
72 QTCOMMERCIALCHART_END_NAMESPACE
66 QTCOMMERCIALCHART_END_NAMESPACE
73
67
74 #endif // DECLARATIVESCATTERSERIES_H
68 #endif // DECLARATIVESCATTERSERIES_H
@@ -1,80 +1,60
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"
22 #include "declarativechart.h"
23 #include <QChart>
23 #include <QChart>
24 #include "declarativexypoint.h"
24 #include "declarativexypoint.h"
25
25
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27
27
28 DeclarativeSplineSeries::DeclarativeSplineSeries(QObject *parent) :
28 DeclarativeSplineSeries::DeclarativeSplineSeries(QObject *parent) :
29 QSplineSeries(parent)
29 QSplineSeries(parent)
30 {
30 {
31 connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
31 connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
32 connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
32 connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
33 }
33 }
34
34
35 QXYSeries *DeclarativeSplineSeries::xySeries()
35 QXYSeries *DeclarativeSplineSeries::xySeries()
36 {
36 {
37 return this;
37 return this;
38 }
38 }
39
39
40 void DeclarativeSplineSeries::setAxisX(QAbstractAxis *axis)
41 {
42 chart()->setAxisX(axis,this);
43 }
44
45 QAbstractAxis *DeclarativeSplineSeries::axisX()
46 {
47 return chart()->axisX(this);
48 }
49
50 void DeclarativeSplineSeries::setAxisY(QAbstractAxis *axis)
51 {
52 chart()->setAxisY(axis,this);
53 }
54
55 QAbstractAxis *DeclarativeSplineSeries::axisY()
56 {
57 return chart()->axisY(this);
58 }
59
60 void DeclarativeSplineSeries::handleCountChanged(int index)
40 void DeclarativeSplineSeries::handleCountChanged(int index)
61 {
41 {
62 Q_UNUSED(index)
42 Q_UNUSED(index)
63 emit countChanged(points().count());
43 emit countChanged(points().count());
64 }
44 }
65
45
66 QDeclarativeListProperty<QObject> DeclarativeSplineSeries::declarativeChildren()
46 QDeclarativeListProperty<QObject> DeclarativeSplineSeries::declarativeChildren()
67 {
47 {
68 return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren);
48 return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren);
69 }
49 }
70
50
71 void DeclarativeSplineSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element)
51 void DeclarativeSplineSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element)
72 {
52 {
73 Q_UNUSED(list)
53 Q_UNUSED(list)
74 Q_UNUSED(element)
54 Q_UNUSED(element)
75 // Empty implementation, childs are parsed in componentComplete
55 // Empty implementation, childs are parsed in componentComplete
76 }
56 }
77
57
78 #include "moc_declarativesplineseries.cpp"
58 #include "moc_declarativesplineseries.cpp"
79
59
80 QTCOMMERCIALCHART_END_NAMESPACE
60 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,75 +1,69
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"
24 #include "qchartglobal.h"
25 #include "qsplineseries.h"
25 #include "qsplineseries.h"
26 #include "declarativexyseries.h"
26 #include "declarativexyseries.h"
27 #include "qabstractaxis.h"
27 #include "qabstractaxis.h"
28 #include <QDeclarativeParserStatus>
28 #include <QDeclarativeParserStatus>
29 #include <QDeclarativeListProperty>
29 #include <QDeclarativeListProperty>
30 #include <QDeclarativeParserStatus>
30 #include <QDeclarativeParserStatus>
31
31
32 QTCOMMERCIALCHART_BEGIN_NAMESPACE
32 QTCOMMERCIALCHART_BEGIN_NAMESPACE
33
33
34 class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries, public QDeclarativeParserStatus
34 class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries, public QDeclarativeParserStatus
35 {
35 {
36 Q_OBJECT
36 Q_OBJECT
37 Q_INTERFACES(QDeclarativeParserStatus)
37 Q_INTERFACES(QDeclarativeParserStatus)
38 Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX)
39 Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY)
40 Q_PROPERTY(int count READ count NOTIFY countChanged)
38 Q_PROPERTY(int count READ count NOTIFY countChanged)
41 Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
39 Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
42 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
40 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
43
41
44 public:
42 public:
45 explicit DeclarativeSplineSeries(QObject *parent = 0);
43 explicit DeclarativeSplineSeries(QObject *parent = 0);
46 QXYSeries *xySeries();
44 QXYSeries *xySeries();
47 void setAxisX(QAbstractAxis *axis);
48 QAbstractAxis *axisX();
49 void setAxisY(QAbstractAxis *axis);
50 QAbstractAxis *axisY();
51 QDeclarativeListProperty<QObject> declarativeChildren();
45 QDeclarativeListProperty<QObject> declarativeChildren();
52
46
53 public: // from QDeclarativeParserStatus
47 public: // from QDeclarativeParserStatus
54 void classBegin() { DeclarativeXySeries::classBegin(); }
48 void classBegin() { DeclarativeXySeries::classBegin(); }
55 void componentComplete() { DeclarativeXySeries::componentComplete(); }
49 void componentComplete() { DeclarativeXySeries::componentComplete(); }
56
50
57 public:
51 public:
58 Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
52 Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
59 Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
53 Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
60 Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
54 Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
61 Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
55 Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
62 Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
56 Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
63 Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
57 Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
64
58
65 Q_SIGNALS:
59 Q_SIGNALS:
66 void countChanged(int count);
60 void countChanged(int count);
67
61
68 public Q_SLOTS:
62 public Q_SLOTS:
69 static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
63 static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
70 void handleCountChanged(int index);
64 void handleCountChanged(int index);
71 };
65 };
72
66
73 QTCOMMERCIALCHART_END_NAMESPACE
67 QTCOMMERCIALCHART_END_NAMESPACE
74
68
75 #endif // DECLARATIVESPLINESERIES_H
69 #endif // DECLARATIVESPLINESERIES_H
General Comments 0
You need to be logged in to leave comments. Login now