@@ -0,0 +1,266 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2016 The Qt Company Ltd. | |
|
4 | ** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). | |
|
5 | ** Contact: https://www.qt.io/licensing/ | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Charts module of the Qt Toolkit. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE:GPL$ | |
|
10 | ** Commercial License Usage | |
|
11 | ** Licensees holding valid commercial Qt licenses may use this file in | |
|
12 | ** accordance with the commercial license agreement provided with the | |
|
13 | ** Software or, alternatively, in accordance with the terms contained in | |
|
14 | ** a written agreement between you and The Qt Company. For licensing terms | |
|
15 | ** and conditions see https://www.qt.io/terms-conditions. For further | |
|
16 | ** information use the contact form at https://www.qt.io/contact-us. | |
|
17 | ** | |
|
18 | ** GNU General Public License Usage | |
|
19 | ** Alternatively, this file may be used under the terms of the GNU | |
|
20 | ** General Public License version 3 or (at your option) any later version | |
|
21 | ** approved by the KDE Free Qt Foundation. The licenses are as published by | |
|
22 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 | |
|
23 | ** included in the packaging of this file. Please review the following | |
|
24 | ** information to ensure the GNU General Public License requirements will | |
|
25 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. | |
|
26 | ** | |
|
27 | ** $QT_END_LICENSE$ | |
|
28 | ** | |
|
29 | ****************************************************************************/ | |
|
30 | ||
|
31 | #include <QtCharts/QHBoxPlotModelMapper> | |
|
32 | ||
|
33 | QT_CHARTS_BEGIN_NAMESPACE | |
|
34 | ||
|
35 | /*! | |
|
36 | \class QHBoxPlotModelMapper | |
|
37 | \inmodule Qt Charts | |
|
38 | \brief Horizontal model mapper for box plot series. | |
|
39 | ||
|
40 | Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series. | |
|
41 | Horizontal model mapper is used to create a connection between QBoxPlotSeries and QAbstractItemModel derived model object. | |
|
42 | Model mapper maintains equal size of all the QBoxSets. | |
|
43 | \note used model has to support adding/removing rows/columns and modifying the data of the cells. | |
|
44 | */ | |
|
45 | /*! | |
|
46 | \qmltype HBoxPlotModelMapper | |
|
47 | \instantiates QHBoxPlotModelMapper | |
|
48 | \inqmlmodule QtCharts | |
|
49 | ||
|
50 | \brief Horizontal model mapper for box plot series. | |
|
51 | ||
|
52 | HBoxPlotModelMapper allows you to use your own QAbstractItemModel derived model with data in | |
|
53 | rows as a data source for any box-and-whiskers series. It is possible to use both | |
|
54 | QAbstractItemModel and box-and-whiskers series data API to manipulate data. HBoxPlotModelMapper | |
|
55 | keeps the series and the model in sync. | |
|
56 | ||
|
57 | The following QML example would create a box-and-whiskers series with three box sets (assuming | |
|
58 | the model has at least four rows). Each box set would contain data starting from column 1. The | |
|
59 | name of a set would be defined by the vertical header (of the row). | |
|
60 | \code | |
|
61 | BoxPlotSeries { | |
|
62 | HBoxPlotModelMapper { | |
|
63 | model: myCustomModel // QAbstractItemModel derived implementation | |
|
64 | firstBoxSetRow: 1 | |
|
65 | lastBoxSetRow: 3 | |
|
66 | firstColumn: 1 | |
|
67 | } | |
|
68 | } | |
|
69 | \endcode | |
|
70 | */ | |
|
71 | ||
|
72 | /*! | |
|
73 | \property QHBoxPlotModelMapper::series | |
|
74 | \brief Defines the QBoxPlotSeries object that is used by the mapper. | |
|
75 | ||
|
76 | All the data in the series is discarded when it is set to the mapper. | |
|
77 | When new series is specified the old series is disconnected (it preserves its data) | |
|
78 | */ | |
|
79 | /*! | |
|
80 | \qmlproperty AbstractBarSeries HBoxPlotModelMapper::series | |
|
81 | Defines the AbstractBarSeries based object that is used by the mapper. All the data in the series is discarded when it is | |
|
82 | set to the mapper. When new series is specified the old series is disconnected (it preserves its data). | |
|
83 | */ | |
|
84 | ||
|
85 | /*! | |
|
86 | \property QHBoxPlotModelMapper::model | |
|
87 | \brief Defines the model that is used by the mapper. | |
|
88 | */ | |
|
89 | /*! | |
|
90 | \qmlproperty SomeModel HBoxPlotModelMapper::model | |
|
91 | The QAbstractItemModel based model that is used by the mapper. You need to implement the model | |
|
92 | and expose it to QML. \note the model has to support adding/removing rows/columns and modifying | |
|
93 | the data of the cells. | |
|
94 | */ | |
|
95 | ||
|
96 | /*! | |
|
97 | \property QHBoxPlotModelMapper::firstBoxSetRow | |
|
98 | \brief Defines which row of the model is used as the data source for the first box-and-whiskers set. | |
|
99 | ||
|
100 | Default value is: -1 (invalid mapping) | |
|
101 | */ | |
|
102 | /*! | |
|
103 | \qmlproperty int HBoxPlotModelMapper::firstBoxSetRow | |
|
104 | Defines which row of the model is used as the data source for the first box-and-whiskers set. Default value | |
|
105 | is: -1 (invalid mapping). | |
|
106 | */ | |
|
107 | ||
|
108 | /*! | |
|
109 | \property QHBoxPlotModelMapper::lastBoxSetRow | |
|
110 | \brief Defines which row of the model is used as the data source for the last box-and-whiskers set. | |
|
111 | ||
|
112 | Default value is: -1 (invalid mapping) | |
|
113 | */ | |
|
114 | /*! | |
|
115 | \qmlproperty int HBoxPlotModelMapper::lastBoxSetRow | |
|
116 | Defines which row of the model is used as the data source for the last box-and-whiskers set. Default | |
|
117 | value is: -1 (invalid mapping). | |
|
118 | */ | |
|
119 | ||
|
120 | /*! | |
|
121 | \property QHBoxPlotModelMapper::firstColumn | |
|
122 | \brief Defines which column of the model contains the first values of the QBoxSets in the series. | |
|
123 | ||
|
124 | Minimal and default value is: 0 | |
|
125 | */ | |
|
126 | /*! | |
|
127 | \qmlproperty int HBoxPlotModelMapper::firstColumn | |
|
128 | Defines which column of the model contains the first values of the QBoxSets in the series. | |
|
129 | The default value is 0. | |
|
130 | */ | |
|
131 | ||
|
132 | /*! | |
|
133 | \property QHBoxPlotModelMapper::columnCount | |
|
134 | \brief Defines the number of column of the model that are mapped as the data for QBoxPlotSeries | |
|
135 | ||
|
136 | Minimal and default value is: -1 (count limited by the number of columns in the model) | |
|
137 | */ | |
|
138 | /*! | |
|
139 | \qmlproperty int HBoxPlotModelMapper::columnCount | |
|
140 | Defines the number of columns of the model that are mapped as the data for QBoxPlotSeries. The default value is | |
|
141 | -1 (count limited by the number of columns in the model) | |
|
142 | */ | |
|
143 | ||
|
144 | /*! | |
|
145 | \fn void QHBoxPlotModelMapper::seriesReplaced() | |
|
146 | ||
|
147 | Emitted when the series to which mapper is connected to has changed. | |
|
148 | */ | |
|
149 | ||
|
150 | /*! | |
|
151 | \fn void QHBoxPlotModelMapper::modelReplaced() | |
|
152 | ||
|
153 | Emitted when the model to which mapper is connected to has changed. | |
|
154 | */ | |
|
155 | ||
|
156 | /*! | |
|
157 | \fn void QHBoxPlotModelMapper::firstBoxSetRowChanged() | |
|
158 | Emitted when the firstBoxSetRow has changed. | |
|
159 | */ | |
|
160 | ||
|
161 | /*! | |
|
162 | \fn void QHBoxPlotModelMapper::lastBoxSetRowChanged() | |
|
163 | Emitted when the lastBoxSetRow has changed. | |
|
164 | */ | |
|
165 | ||
|
166 | /*! | |
|
167 | \fn void QHBoxPlotModelMapper::firstColumnChanged() | |
|
168 | Emitted when the firstColumn has changed. | |
|
169 | */ | |
|
170 | ||
|
171 | /*! | |
|
172 | \fn void QHBoxPlotModelMapper::columnCountChanged() | |
|
173 | Emitted when the columnCount has changed. | |
|
174 | */ | |
|
175 | ||
|
176 | /*! | |
|
177 | Constructs a mapper object which is a child of \a parent. | |
|
178 | */ | |
|
179 | QHBoxPlotModelMapper::QHBoxPlotModelMapper(QObject *parent) : | |
|
180 | QBoxPlotModelMapper(parent) | |
|
181 | { | |
|
182 | QBoxPlotModelMapper::setOrientation(Qt::Horizontal); | |
|
183 | } | |
|
184 | ||
|
185 | QAbstractItemModel *QHBoxPlotModelMapper::model() const | |
|
186 | { | |
|
187 | return QBoxPlotModelMapper::model(); | |
|
188 | } | |
|
189 | ||
|
190 | void QHBoxPlotModelMapper::setModel(QAbstractItemModel *model) | |
|
191 | { | |
|
192 | if (model != QBoxPlotModelMapper::model()) { | |
|
193 | QBoxPlotModelMapper::setModel(model); | |
|
194 | emit modelReplaced(); | |
|
195 | } | |
|
196 | } | |
|
197 | ||
|
198 | QBoxPlotSeries *QHBoxPlotModelMapper::series() const | |
|
199 | { | |
|
200 | return QBoxPlotModelMapper::series(); | |
|
201 | } | |
|
202 | ||
|
203 | void QHBoxPlotModelMapper::setSeries(QBoxPlotSeries *series) | |
|
204 | { | |
|
205 | if (series != QBoxPlotModelMapper::series()) { | |
|
206 | QBoxPlotModelMapper::setSeries(series); | |
|
207 | emit seriesReplaced(); | |
|
208 | } | |
|
209 | } | |
|
210 | ||
|
211 | int QHBoxPlotModelMapper::firstBoxSetRow() const | |
|
212 | { | |
|
213 | return QBoxPlotModelMapper::firstBoxSetSection(); | |
|
214 | } | |
|
215 | ||
|
216 | void QHBoxPlotModelMapper::setFirstBoxSetRow(int firstBoxSetRow) | |
|
217 | { | |
|
218 | if (firstBoxSetRow != firstBoxSetSection()) { | |
|
219 | QBoxPlotModelMapper::setFirstBoxSetSection(firstBoxSetRow); | |
|
220 | emit firstBoxSetRowChanged(); | |
|
221 | } | |
|
222 | } | |
|
223 | ||
|
224 | int QHBoxPlotModelMapper::lastBoxSetRow() const | |
|
225 | { | |
|
226 | return QBoxPlotModelMapper::lastBoxSetSection(); | |
|
227 | } | |
|
228 | ||
|
229 | void QHBoxPlotModelMapper::setLastBoxSetRow(int lastBoxSetRow) | |
|
230 | { | |
|
231 | if (lastBoxSetRow != lastBoxSetSection()) { | |
|
232 | QBoxPlotModelMapper::setLastBoxSetSection(lastBoxSetRow); | |
|
233 | emit lastBoxSetRowChanged(); | |
|
234 | } | |
|
235 | } | |
|
236 | ||
|
237 | int QHBoxPlotModelMapper::firstColumn() const | |
|
238 | { | |
|
239 | return QBoxPlotModelMapper::first(); | |
|
240 | } | |
|
241 | ||
|
242 | void QHBoxPlotModelMapper::setFirstColumn(int firstColumn) | |
|
243 | { | |
|
244 | if (firstColumn != first()) { | |
|
245 | QBoxPlotModelMapper::setFirst(firstColumn); | |
|
246 | emit firstColumnChanged(); | |
|
247 | } | |
|
248 | } | |
|
249 | ||
|
250 | int QHBoxPlotModelMapper::columnCount() const | |
|
251 | { | |
|
252 | return QBoxPlotModelMapper::count(); | |
|
253 | } | |
|
254 | ||
|
255 | void QHBoxPlotModelMapper::setColumnCount(int columnCount) | |
|
256 | { | |
|
257 | if (columnCount != count()) { | |
|
258 | QBoxPlotModelMapper::setCount(columnCount); | |
|
259 | emit columnCountChanged(); | |
|
260 | } | |
|
261 | } | |
|
262 | ||
|
263 | #include "moc_qhboxplotmodelmapper.cpp" | |
|
264 | ||
|
265 | QT_CHARTS_END_NAMESPACE | |
|
266 |
@@ -0,0 +1,80 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2016 The Qt Company Ltd. | |
|
4 | ** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). | |
|
5 | ** Contact: https://www.qt.io/licensing/ | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Charts module of the Qt Toolkit. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE:GPL$ | |
|
10 | ** Commercial License Usage | |
|
11 | ** Licensees holding valid commercial Qt licenses may use this file in | |
|
12 | ** accordance with the commercial license agreement provided with the | |
|
13 | ** Software or, alternatively, in accordance with the terms contained in | |
|
14 | ** a written agreement between you and The Qt Company. For licensing terms | |
|
15 | ** and conditions see https://www.qt.io/terms-conditions. For further | |
|
16 | ** information use the contact form at https://www.qt.io/contact-us. | |
|
17 | ** | |
|
18 | ** GNU General Public License Usage | |
|
19 | ** Alternatively, this file may be used under the terms of the GNU | |
|
20 | ** General Public License version 3 or (at your option) any later version | |
|
21 | ** approved by the KDE Free Qt Foundation. The licenses are as published by | |
|
22 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 | |
|
23 | ** included in the packaging of this file. Please review the following | |
|
24 | ** information to ensure the GNU General Public License requirements will | |
|
25 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. | |
|
26 | ** | |
|
27 | ** $QT_END_LICENSE$ | |
|
28 | ** | |
|
29 | ****************************************************************************/ | |
|
30 | ||
|
31 | #ifndef QHBOXPLOTMODELMAPPER_H | |
|
32 | #define QHBOXPLOTMODELMAPPER_H | |
|
33 | ||
|
34 | #include <QtCharts/QBoxPlotModelMapper> | |
|
35 | ||
|
36 | QT_CHARTS_BEGIN_NAMESPACE | |
|
37 | /* Comment line for syncqt to generate the fwd-include correctly, due to QTBUG-22432 */ | |
|
38 | class QT_CHARTS_EXPORT QHBoxPlotModelMapper : public QBoxPlotModelMapper | |
|
39 | { | |
|
40 | Q_OBJECT | |
|
41 | Q_PROPERTY(QBoxPlotSeries *series READ series WRITE setSeries NOTIFY seriesReplaced) | |
|
42 | Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced) | |
|
43 | Q_PROPERTY(int firstBoxSetRow READ firstBoxSetRow WRITE setFirstBoxSetRow NOTIFY firstBoxSetRowChanged) | |
|
44 | Q_PROPERTY(int lastBoxSetRow READ lastBoxSetRow WRITE setLastBoxSetRow NOTIFY lastBoxSetRowChanged) | |
|
45 | Q_PROPERTY(int firstColumn READ firstColumn WRITE setFirstColumn NOTIFY firstColumnChanged) | |
|
46 | Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount NOTIFY columnCountChanged) | |
|
47 | ||
|
48 | public: | |
|
49 | explicit QHBoxPlotModelMapper(QObject *parent = nullptr); | |
|
50 | ||
|
51 | QAbstractItemModel *model() const; | |
|
52 | void setModel(QAbstractItemModel *model); | |
|
53 | ||
|
54 | QBoxPlotSeries *series() const; | |
|
55 | void setSeries(QBoxPlotSeries *series); | |
|
56 | ||
|
57 | int firstBoxSetRow() const; | |
|
58 | void setFirstBoxSetRow(int firstBoxSetRow); | |
|
59 | ||
|
60 | int lastBoxSetRow() const; | |
|
61 | void setLastBoxSetRow(int lastBoxSetRow); | |
|
62 | ||
|
63 | int firstColumn() const; | |
|
64 | void setFirstColumn(int firstColumn); | |
|
65 | ||
|
66 | int columnCount() const; | |
|
67 | void setColumnCount(int rowCount); | |
|
68 | ||
|
69 | Q_SIGNALS: | |
|
70 | void seriesReplaced(); | |
|
71 | void modelReplaced(); | |
|
72 | void firstBoxSetRowChanged(); | |
|
73 | void lastBoxSetRowChanged(); | |
|
74 | void firstColumnChanged(); | |
|
75 | void columnCountChanged(); | |
|
76 | }; | |
|
77 | ||
|
78 | QT_CHARTS_END_NAMESPACE | |
|
79 | ||
|
80 | #endif // QHBOXPLOTMODELMAPPER_H |
@@ -1,25 +1,27 | |||
|
1 | 1 | INCLUDEPATH += $$PWD |
|
2 | 2 | DEPENDPATH += $$PWD |
|
3 | 3 | |
|
4 | 4 | SOURCES += \ |
|
5 | 5 | $$PWD/boxplotchartitem.cpp \ |
|
6 | 6 | $$PWD/qboxplotseries.cpp \ |
|
7 | 7 | $$PWD/boxwhiskers.cpp \ |
|
8 | 8 | $$PWD/qboxset.cpp \ |
|
9 | 9 | $$PWD/qboxplotmodelmapper.cpp \ |
|
10 | $$PWD/qhboxplotmodelmapper.cpp \ | |
|
10 | 11 | $$PWD/qvboxplotmodelmapper.cpp |
|
11 | 12 | |
|
12 | 13 | PRIVATE_HEADERS += \ |
|
13 | 14 | $$PWD/boxplotchartitem_p.h \ |
|
14 | 15 | $$PWD/qboxplotseries_p.h \ |
|
15 | 16 | $$PWD/boxwhiskers_p.h \ |
|
16 | 17 | $$PWD/boxwhiskersdata_p.h \ |
|
17 | 18 | $$PWD/qboxset_p.h \ |
|
18 | 19 | $$PWD/qboxplotmodelmapper_p.h |
|
19 | 20 | |
|
20 | 21 | PUBLIC_HEADERS += \ |
|
21 | 22 | $$PWD/qboxplotseries.h \ |
|
22 | 23 | $$PWD/qboxset.h \ |
|
23 | 24 | $$PWD/qboxplotmodelmapper.h \ |
|
25 | $$PWD/qhboxplotmodelmapper.h \ | |
|
24 | 26 | $$PWD/qvboxplotmodelmapper.h |
|
25 | 27 |
@@ -1,265 +1,265 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
|
4 | 4 | ** Contact: https://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module of the Qt Toolkit. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:GPL$ |
|
9 | 9 | ** Commercial License Usage |
|
10 | 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
11 | 11 | ** accordance with the commercial license agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and The Qt Company. For licensing terms |
|
14 | 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
|
15 | 15 | ** information use the contact form at https://www.qt.io/contact-us. |
|
16 | 16 | ** |
|
17 | 17 | ** GNU General Public License Usage |
|
18 | 18 | ** Alternatively, this file may be used under the terms of the GNU |
|
19 | 19 | ** General Public License version 3 or (at your option) any later version |
|
20 | 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by |
|
21 | 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 |
|
22 | 22 | ** included in the packaging of this file. Please review the following |
|
23 | 23 | ** information to ensure the GNU General Public License requirements will |
|
24 | 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
|
25 | 25 | ** |
|
26 | 26 | ** $QT_END_LICENSE$ |
|
27 | 27 | ** |
|
28 | 28 | ****************************************************************************/ |
|
29 | 29 | |
|
30 | 30 | #include <QtCharts/QVBoxPlotModelMapper> |
|
31 | 31 | |
|
32 | 32 | QT_CHARTS_BEGIN_NAMESPACE |
|
33 | 33 | |
|
34 | 34 | /*! |
|
35 | 35 | \class QVBoxPlotModelMapper |
|
36 | 36 | \inmodule Qt Charts |
|
37 | 37 | \brief Vertical model mapper for box plot series. |
|
38 | 38 | |
|
39 | 39 | Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series. |
|
40 | 40 | Vertical model mapper is used to create a connection between QBoxPlotSeries and QAbstractItemModel derived model object. |
|
41 | 41 | Model mapper maintains equal size of all the QBoxSets. |
|
42 | 42 | \note used model has to support adding/removing rows/columns and modifying the data of the cells. |
|
43 | 43 | */ |
|
44 | 44 | /*! |
|
45 | 45 | \qmltype VBoxPlotModelMapper |
|
46 | 46 | \instantiates QVBoxPlotModelMapper |
|
47 | 47 | \inqmlmodule QtCharts |
|
48 | 48 | |
|
49 | 49 | \brief Vertical model mapper for box plot series. |
|
50 | 50 | |
|
51 | 51 | VBoxPlotModelMapper allows you to use your own QAbstractItemModel derived model with data in |
|
52 | 52 | columns as a data source for any box-and-whiskers series. It is possible to use both |
|
53 | 53 | QAbstractItemModel and box-and-whiskers series data API to manipulate data. VBoxPlotModelMapper |
|
54 | 54 | keeps the series and the model in sync. |
|
55 | 55 | |
|
56 | 56 | The following QML example would create a box-and-whiskers series with three box sets (assuming |
|
57 | 57 | the model has at least four columns). Each box set would contain data starting from row 1. The |
|
58 | 58 | name of a set would be defined by the horizontal header (of the column). |
|
59 | 59 | \code |
|
60 | 60 | BoxPlotSeries { |
|
61 | 61 | VBoxPlotModelMapper { |
|
62 | 62 | model: myCustomModel // QAbstractItemModel derived implementation |
|
63 | 63 | firstBoxSetColumn: 1 |
|
64 | 64 | lastBoxSetColumn: 3 |
|
65 | 65 | firstRow: 1 |
|
66 | 66 | } |
|
67 | 67 | } |
|
68 | 68 | \endcode |
|
69 | 69 | */ |
|
70 | 70 | |
|
71 | 71 | /*! |
|
72 | 72 | \property QVBoxPlotModelMapper::series |
|
73 | 73 | \brief Defines the QBoxPlotSeries object that is used by the mapper. |
|
74 | 74 | |
|
75 | 75 | All the data in the series is discarded when it is set to the mapper. |
|
76 | 76 | When new series is specified the old series is disconnected (it preserves its data) |
|
77 | 77 | */ |
|
78 | 78 | /*! |
|
79 | 79 | \qmlproperty AbstractBarSeries VBoxPlotModelMapper::series |
|
80 | 80 | Defines the AbstractBarSeries based object that is used by the mapper. All the data in the series is discarded when it is |
|
81 | 81 | set to the mapper. When new series is specified the old series is disconnected (it preserves its data). |
|
82 | 82 | */ |
|
83 | 83 | |
|
84 | 84 | /*! |
|
85 | 85 | \property QVBoxPlotModelMapper::model |
|
86 | 86 | \brief Defines the model that is used by the mapper. |
|
87 | 87 | */ |
|
88 | 88 | /*! |
|
89 | 89 | \qmlproperty SomeModel VBoxPlotModelMapper::model |
|
90 | 90 | The QAbstractItemModel based model that is used by the mapper. You need to implement the model |
|
91 | 91 | and expose it to QML. \note the model has to support adding/removing rows/columns and modifying |
|
92 | 92 | the data of the cells. |
|
93 | 93 | */ |
|
94 | 94 | |
|
95 | 95 | /*! |
|
96 | 96 | \property QVBoxPlotModelMapper::firstBoxSetColumn |
|
97 | 97 | \brief Defines which column of the model is used as the data source for the first box-and-whiskers set. |
|
98 | 98 | |
|
99 | 99 | Default value is: -1 (invalid mapping) |
|
100 | 100 | */ |
|
101 | 101 | /*! |
|
102 |
\qmlproperty int VB |
|
|
102 | \qmlproperty int VBoxPlotModelMapper::firstBoxSetColumn | |
|
103 | 103 | Defines which column of the model is used as the data source for the first box-and-whiskers set. Default value |
|
104 | 104 | is: -1 (invalid mapping). |
|
105 | 105 | */ |
|
106 | 106 | |
|
107 | 107 | /*! |
|
108 | 108 | \property QVBoxPlotModelMapper::lastBoxSetColumn |
|
109 | 109 | \brief Defines which column of the model is used as the data source for the last box-and-whiskers set. |
|
110 | 110 | |
|
111 | 111 | Default value is: -1 (invalid mapping) |
|
112 | 112 | */ |
|
113 | 113 | /*! |
|
114 |
\qmlproperty int VB |
|
|
114 | \qmlproperty int VBoxPlotModelMapper::lastBoxSetColumn | |
|
115 | 115 | Defines which column of the model is used as the data source for the last box-and-whiskers set. Default |
|
116 | 116 | value is: -1 (invalid mapping). |
|
117 | 117 | */ |
|
118 | 118 | |
|
119 | 119 | /*! |
|
120 | 120 | \property QVBoxPlotModelMapper::firstRow |
|
121 | 121 | \brief Defines which row of the model contains the first values of the QBoxSets in the series. |
|
122 | 122 | |
|
123 | 123 | Minimal and default value is: 0 |
|
124 | 124 | */ |
|
125 | 125 | /*! |
|
126 | 126 | \qmlproperty int VBoxPlotModelMapper::firstRow |
|
127 | 127 | Defines which row of the model contains the first values of the QBoxSets in the series. |
|
128 | 128 | The default value is 0. |
|
129 | 129 | */ |
|
130 | 130 | |
|
131 | 131 | /*! |
|
132 | 132 | \property QVBoxPlotModelMapper::rowCount |
|
133 | 133 | \brief Defines the number of rows of the model that are mapped as the data for QBoxPlotSeries |
|
134 | 134 | |
|
135 | 135 | Minimal and default value is: -1 (count limited by the number of rows in the model) |
|
136 | 136 | */ |
|
137 | 137 | /*! |
|
138 | \qmlproperty int VBoxModelMapper::rowCount | |
|
138 | \qmlproperty int VBoxPlotModelMapper::rowCount | |
|
139 | 139 | Defines the number of rows of the model that are mapped as the data for QBoxPlotSeries. The default value is |
|
140 | 140 | -1 (count limited by the number of rows in the model) |
|
141 | 141 | */ |
|
142 | 142 | |
|
143 | 143 | /*! |
|
144 | 144 | \fn void QVBoxPlotModelMapper::seriesReplaced() |
|
145 | 145 | |
|
146 | 146 | Emitted when the series to which mapper is connected to has changed. |
|
147 | 147 | */ |
|
148 | 148 | |
|
149 | 149 | /*! |
|
150 | 150 | \fn void QVBoxPlotModelMapper::modelReplaced() |
|
151 | 151 | |
|
152 | 152 | Emitted when the model to which mapper is connected to has changed. |
|
153 | 153 | */ |
|
154 | 154 | |
|
155 | 155 | /*! |
|
156 | 156 | \fn void QVBoxPlotModelMapper::firstBoxSetColumnChanged() |
|
157 | 157 | Emitted when the firstBoxSetColumn has changed. |
|
158 | 158 | */ |
|
159 | 159 | |
|
160 | 160 | /*! |
|
161 | 161 | \fn void QVBoxPlotModelMapper::lastBoxSetColumnChanged() |
|
162 | 162 | Emitted when the lastBoxSetColumn has changed. |
|
163 | 163 | */ |
|
164 | 164 | |
|
165 | 165 | /*! |
|
166 | 166 | \fn void QVBoxPlotModelMapper::firstRowChanged() |
|
167 | 167 | Emitted when the firstRow has changed. |
|
168 | 168 | */ |
|
169 | 169 | |
|
170 | 170 | /*! |
|
171 | 171 | \fn void QVBoxPlotModelMapper::rowCountChanged() |
|
172 | 172 | Emitted when the rowCount has changed. |
|
173 | 173 | */ |
|
174 | 174 | |
|
175 | 175 | /*! |
|
176 | 176 | Constructs a mapper object which is a child of \a parent. |
|
177 | 177 | */ |
|
178 | 178 | QVBoxPlotModelMapper::QVBoxPlotModelMapper(QObject *parent) : |
|
179 | 179 | QBoxPlotModelMapper(parent) |
|
180 | 180 | { |
|
181 | 181 | QBoxPlotModelMapper::setOrientation(Qt::Vertical); |
|
182 | 182 | } |
|
183 | 183 | |
|
184 | 184 | QAbstractItemModel *QVBoxPlotModelMapper::model() const |
|
185 | 185 | { |
|
186 | 186 | return QBoxPlotModelMapper::model(); |
|
187 | 187 | } |
|
188 | 188 | |
|
189 | 189 | void QVBoxPlotModelMapper::setModel(QAbstractItemModel *model) |
|
190 | 190 | { |
|
191 | 191 | if (model != QBoxPlotModelMapper::model()) { |
|
192 | 192 | QBoxPlotModelMapper::setModel(model); |
|
193 | 193 | emit modelReplaced(); |
|
194 | 194 | } |
|
195 | 195 | } |
|
196 | 196 | |
|
197 | 197 | QBoxPlotSeries *QVBoxPlotModelMapper::series() const |
|
198 | 198 | { |
|
199 | 199 | return QBoxPlotModelMapper::series(); |
|
200 | 200 | } |
|
201 | 201 | |
|
202 | 202 | void QVBoxPlotModelMapper::setSeries(QBoxPlotSeries *series) |
|
203 | 203 | { |
|
204 | 204 | if (series != QBoxPlotModelMapper::series()) { |
|
205 | 205 | QBoxPlotModelMapper::setSeries(series); |
|
206 | 206 | emit seriesReplaced(); |
|
207 | 207 | } |
|
208 | 208 | } |
|
209 | 209 | |
|
210 | 210 | int QVBoxPlotModelMapper::firstBoxSetColumn() const |
|
211 | 211 | { |
|
212 | 212 | return QBoxPlotModelMapper::firstBoxSetSection(); |
|
213 | 213 | } |
|
214 | 214 | |
|
215 | 215 | void QVBoxPlotModelMapper::setFirstBoxSetColumn(int firstBoxSetColumn) |
|
216 | 216 | { |
|
217 | 217 | if (firstBoxSetColumn != firstBoxSetSection()) { |
|
218 | 218 | QBoxPlotModelMapper::setFirstBoxSetSection(firstBoxSetColumn); |
|
219 | 219 | emit firstBoxSetColumnChanged(); |
|
220 | 220 | } |
|
221 | 221 | } |
|
222 | 222 | |
|
223 | 223 | int QVBoxPlotModelMapper::lastBoxSetColumn() const |
|
224 | 224 | { |
|
225 | 225 | return QBoxPlotModelMapper::lastBoxSetSection(); |
|
226 | 226 | } |
|
227 | 227 | |
|
228 | 228 | void QVBoxPlotModelMapper::setLastBoxSetColumn(int lastBoxSetColumn) |
|
229 | 229 | { |
|
230 | 230 | if (lastBoxSetColumn != lastBoxSetSection()) { |
|
231 | 231 | QBoxPlotModelMapper::setLastBoxSetSection(lastBoxSetColumn); |
|
232 | 232 | emit lastBoxSetColumnChanged(); |
|
233 | 233 | } |
|
234 | 234 | } |
|
235 | 235 | |
|
236 | 236 | int QVBoxPlotModelMapper::firstRow() const |
|
237 | 237 | { |
|
238 | 238 | return QBoxPlotModelMapper::first(); |
|
239 | 239 | } |
|
240 | 240 | |
|
241 | 241 | void QVBoxPlotModelMapper::setFirstRow(int firstRow) |
|
242 | 242 | { |
|
243 | 243 | if (firstRow != first()) { |
|
244 | 244 | QBoxPlotModelMapper::setFirst(firstRow); |
|
245 | 245 | emit firstRowChanged(); |
|
246 | 246 | } |
|
247 | 247 | } |
|
248 | 248 | |
|
249 | 249 | int QVBoxPlotModelMapper::rowCount() const |
|
250 | 250 | { |
|
251 | 251 | return QBoxPlotModelMapper::count(); |
|
252 | 252 | } |
|
253 | 253 | |
|
254 | 254 | void QVBoxPlotModelMapper::setRowCount(int rowCount) |
|
255 | 255 | { |
|
256 | 256 | if (rowCount != count()) { |
|
257 | 257 | QBoxPlotModelMapper::setCount(rowCount); |
|
258 | 258 | emit rowCountChanged(); |
|
259 | 259 | } |
|
260 | 260 | } |
|
261 | 261 | |
|
262 | 262 | #include "moc_qvboxplotmodelmapper.cpp" |
|
263 | 263 | |
|
264 | 264 | QT_CHARTS_END_NAMESPACE |
|
265 | 265 |
@@ -1,333 +1,336 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
|
4 | 4 | ** Contact: https://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module of the Qt Toolkit. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:GPL$ |
|
9 | 9 | ** Commercial License Usage |
|
10 | 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
11 | 11 | ** accordance with the commercial license agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and The Qt Company. For licensing terms |
|
14 | 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
|
15 | 15 | ** information use the contact form at https://www.qt.io/contact-us. |
|
16 | 16 | ** |
|
17 | 17 | ** GNU General Public License Usage |
|
18 | 18 | ** Alternatively, this file may be used under the terms of the GNU |
|
19 | 19 | ** General Public License version 3 or (at your option) any later version |
|
20 | 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by |
|
21 | 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 |
|
22 | 22 | ** included in the packaging of this file. Please review the following |
|
23 | 23 | ** information to ensure the GNU General Public License requirements will |
|
24 | 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
|
25 | 25 | ** |
|
26 | 26 | ** $QT_END_LICENSE$ |
|
27 | 27 | ** |
|
28 | 28 | ****************************************************************************/ |
|
29 | 29 | |
|
30 | 30 | #include <QtCharts/QChart> |
|
31 | 31 | #include <QtCharts/QAbstractAxis> |
|
32 | 32 | #include <QtCharts/QValueAxis> |
|
33 | 33 | #include <QtCharts/QLogValueAxis> |
|
34 | 34 | #include "declarativecategoryaxis.h" |
|
35 | 35 | #include <QtCharts/QBarCategoryAxis> |
|
36 | 36 | #include "declarativechart.h" |
|
37 | 37 | #include "declarativepolarchart.h" |
|
38 | 38 | #include "declarativexypoint.h" |
|
39 | 39 | #include "declarativelineseries.h" |
|
40 | 40 | #include "declarativesplineseries.h" |
|
41 | 41 | #include "declarativeareaseries.h" |
|
42 | 42 | #include "declarativescatterseries.h" |
|
43 | 43 | #include "declarativebarseries.h" |
|
44 | 44 | #include "declarativeboxplotseries.h" |
|
45 | 45 | #include "declarativepieseries.h" |
|
46 | 46 | #include "declarativeaxes.h" |
|
47 | 47 | #include <QtCharts/QVXYModelMapper> |
|
48 | 48 | #include <QtCharts/QHXYModelMapper> |
|
49 | 49 | #include <QtCharts/QHPieModelMapper> |
|
50 | 50 | #include <QtCharts/QVPieModelMapper> |
|
51 | 51 | #include <QtCharts/QHBarModelMapper> |
|
52 | 52 | #include <QtCharts/QVBarModelMapper> |
|
53 | 53 | #include "declarativemargins.h" |
|
54 | 54 | #include <QtCharts/QAreaLegendMarker> |
|
55 | 55 | #include <QtCharts/QBarLegendMarker> |
|
56 | 56 | #include <QtCharts/QPieLegendMarker> |
|
57 | 57 | #include <QtCharts/QXYLegendMarker> |
|
58 | 58 | #include <QtCharts/QBoxPlotModelMapper> |
|
59 | #include <QtCharts/QHBoxPlotModelMapper> | |
|
59 | 60 | #include <QtCharts/QVBoxPlotModelMapper> |
|
60 | 61 | #ifndef QT_QREAL_IS_FLOAT |
|
61 | 62 | #include <QtCharts/QDateTimeAxis> |
|
62 | 63 | #endif |
|
63 | 64 | #include <QtCore/QAbstractItemModel> |
|
64 | 65 | #include <QtQml> |
|
65 | 66 | |
|
66 | 67 | QT_CHARTS_USE_NAMESPACE |
|
67 | 68 | |
|
68 | 69 | QML_DECLARE_TYPE(QList<QPieSlice *>) |
|
69 | 70 | QML_DECLARE_TYPE(QList<QBarSet *>) |
|
70 | 71 | QML_DECLARE_TYPE(QList<QAbstractAxis *>) |
|
71 | 72 | |
|
72 | 73 | QML_DECLARE_TYPE(DeclarativeChart) |
|
73 | 74 | QML_DECLARE_TYPE(DeclarativePolarChart) |
|
74 | 75 | QML_DECLARE_TYPE(DeclarativeMargins) |
|
75 | 76 | QML_DECLARE_TYPE(DeclarativeAreaSeries) |
|
76 | 77 | QML_DECLARE_TYPE(DeclarativeBarSeries) |
|
77 | 78 | QML_DECLARE_TYPE(DeclarativeBarSet) |
|
78 | 79 | QML_DECLARE_TYPE(DeclarativeBoxPlotSeries) |
|
79 | 80 | QML_DECLARE_TYPE(DeclarativeBoxSet) |
|
80 | 81 | QML_DECLARE_TYPE(DeclarativeLineSeries) |
|
81 | 82 | QML_DECLARE_TYPE(DeclarativePieSeries) |
|
82 | 83 | QML_DECLARE_TYPE(DeclarativePieSlice) |
|
83 | 84 | QML_DECLARE_TYPE(DeclarativeScatterSeries) |
|
84 | 85 | QML_DECLARE_TYPE(DeclarativeSplineSeries) |
|
85 | 86 | |
|
86 | 87 | QML_DECLARE_TYPE(QAbstractAxis) |
|
87 | 88 | QML_DECLARE_TYPE(QValueAxis) |
|
88 | 89 | QML_DECLARE_TYPE(QBarCategoryAxis) |
|
89 | 90 | QML_DECLARE_TYPE(QCategoryAxis) |
|
90 | 91 | #ifndef QT_QREAL_IS_FLOAT |
|
91 | 92 | QML_DECLARE_TYPE(QDateTimeAxis) |
|
92 | 93 | #endif |
|
93 | 94 | QML_DECLARE_TYPE(QLogValueAxis) |
|
94 | 95 | |
|
95 | 96 | QML_DECLARE_TYPE(QLegend) |
|
96 | 97 | QML_DECLARE_TYPE(QLegendMarker) |
|
97 | 98 | QML_DECLARE_TYPE(QAreaLegendMarker) |
|
98 | 99 | QML_DECLARE_TYPE(QBarLegendMarker) |
|
99 | 100 | QML_DECLARE_TYPE(QPieLegendMarker) |
|
100 | 101 | |
|
101 | 102 | QML_DECLARE_TYPE(QHPieModelMapper) |
|
102 | 103 | QML_DECLARE_TYPE(QHXYModelMapper) |
|
103 | 104 | QML_DECLARE_TYPE(QPieModelMapper) |
|
104 | 105 | QML_DECLARE_TYPE(QHBarModelMapper) |
|
105 | 106 | QML_DECLARE_TYPE(QBarModelMapper) |
|
106 | 107 | QML_DECLARE_TYPE(QVBarModelMapper) |
|
107 | 108 | QML_DECLARE_TYPE(QVPieModelMapper) |
|
108 | 109 | QML_DECLARE_TYPE(QVXYModelMapper) |
|
109 | 110 | QML_DECLARE_TYPE(QXYLegendMarker) |
|
110 | 111 | QML_DECLARE_TYPE(QXYModelMapper) |
|
111 | 112 | QML_DECLARE_TYPE(QBoxPlotModelMapper) |
|
113 | QML_DECLARE_TYPE(QHBoxPlotModelMapper) | |
|
112 | 114 | QML_DECLARE_TYPE(QVBoxPlotModelMapper) |
|
113 | 115 | |
|
114 | 116 | QML_DECLARE_TYPE(QAbstractSeries) |
|
115 | 117 | QML_DECLARE_TYPE(QXYSeries) |
|
116 | 118 | QML_DECLARE_TYPE(QAbstractBarSeries) |
|
117 | 119 | QML_DECLARE_TYPE(QBarSeries) |
|
118 | 120 | QML_DECLARE_TYPE(QBarSet) |
|
119 | 121 | QML_DECLARE_TYPE(QAreaSeries) |
|
120 | 122 | QML_DECLARE_TYPE(QHorizontalBarSeries) |
|
121 | 123 | QML_DECLARE_TYPE(QHorizontalPercentBarSeries) |
|
122 | 124 | QML_DECLARE_TYPE(QHorizontalStackedBarSeries) |
|
123 | 125 | QML_DECLARE_TYPE(QLineSeries) |
|
124 | 126 | QML_DECLARE_TYPE(QPercentBarSeries) |
|
125 | 127 | QML_DECLARE_TYPE(QPieSeries) |
|
126 | 128 | QML_DECLARE_TYPE(QPieSlice) |
|
127 | 129 | QML_DECLARE_TYPE(QScatterSeries) |
|
128 | 130 | QML_DECLARE_TYPE(QSplineSeries) |
|
129 | 131 | QML_DECLARE_TYPE(QStackedBarSeries) |
|
130 | 132 | |
|
131 | 133 | QT_CHARTS_BEGIN_NAMESPACE |
|
132 | 134 | |
|
133 | 135 | class QtChartsQml2Plugin : public QQmlExtensionPlugin |
|
134 | 136 | { |
|
135 | 137 | Q_OBJECT |
|
136 | 138 | |
|
137 | 139 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") |
|
138 | 140 | |
|
139 | 141 | public: |
|
140 | 142 | virtual void registerTypes(const char *uri) |
|
141 | 143 | { |
|
142 | 144 | Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCharts")); |
|
143 | 145 | |
|
144 | 146 | // @uri QtCharts |
|
145 | 147 | |
|
146 | 148 | qRegisterMetaType<QList<QPieSlice *> >(); |
|
147 | 149 | qRegisterMetaType<QList<QBarSet *> >(); |
|
148 | 150 | qRegisterMetaType<QList<QAbstractAxis *> >(); |
|
149 | 151 | |
|
150 | 152 | // QtCharts 1.0 |
|
151 | 153 | qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView"); |
|
152 | 154 | qmlRegisterType<DeclarativeXYPoint>(uri, 1, 0, "XYPoint"); |
|
153 | 155 | qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries"); |
|
154 | 156 | qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries"); |
|
155 | 157 | qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries"); |
|
156 | 158 | qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries"); |
|
157 | 159 | qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries"); |
|
158 | 160 | qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries"); |
|
159 | 161 | qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries"); |
|
160 | 162 | qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries"); |
|
161 | 163 | qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice"); |
|
162 | 164 | qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet"); |
|
163 | 165 | qmlRegisterType<QHXYModelMapper>(uri, 1, 0, "HXYModelMapper"); |
|
164 | 166 | qmlRegisterType<QVXYModelMapper>(uri, 1, 0, "VXYModelMapper"); |
|
165 | 167 | qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper"); |
|
166 | 168 | qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper"); |
|
167 | 169 | qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper"); |
|
168 | 170 | qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper"); |
|
169 | 171 | |
|
170 | 172 | qmlRegisterType<QValueAxis>(uri, 1, 0, "ValuesAxis"); |
|
171 | 173 | qmlRegisterType<QBarCategoryAxis>(uri, 1, 0, "BarCategoriesAxis"); |
|
172 | 174 | qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend", |
|
173 | 175 | QLatin1String("Trying to create uncreatable: Legend.")); |
|
174 | 176 | qmlRegisterUncreatableType<QXYSeries>(uri, 1, 0, "XYSeries", |
|
175 | 177 | QLatin1String("Trying to create uncreatable: XYSeries.")); |
|
176 | 178 | qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel", |
|
177 | 179 | QLatin1String("Trying to create uncreatable: AbstractItemModel.")); |
|
178 | 180 | qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper", |
|
179 | 181 | QLatin1String("Trying to create uncreatable: XYModelMapper.")); |
|
180 | 182 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper", |
|
181 | 183 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); |
|
182 | 184 | qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 0, "BarModelMapper", |
|
183 | 185 | QLatin1String("Trying to create uncreatable: BarModelMapper.")); |
|
184 | 186 | qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries", |
|
185 | 187 | QLatin1String("Trying to create uncreatable: AbstractSeries.")); |
|
186 | 188 | qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 0, "AbstractBarSeries", |
|
187 | 189 | QLatin1String("Trying to create uncreatable: AbstractBarSeries.")); |
|
188 | 190 | qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 0, "AbstractAxis", |
|
189 | 191 | QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead.")); |
|
190 | 192 | qmlRegisterUncreatableType<QBarSet>(uri, 1, 0, "BarSetBase", |
|
191 | 193 | QLatin1String("Trying to create uncreatable: BarsetBase.")); |
|
192 | 194 | qmlRegisterUncreatableType<QPieSeries>(uri, 1, 0, "QPieSeries", |
|
193 | 195 | QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead.")); |
|
194 | 196 | qmlRegisterUncreatableType<DeclarativeAxes>(uri, 1, 0, "DeclarativeAxes", |
|
195 | 197 | QLatin1String("Trying to create uncreatable: DeclarativeAxes.")); |
|
196 | 198 | |
|
197 | 199 | // QtCharts 1.1 |
|
198 | 200 | qmlRegisterType<DeclarativeChart, 1>(uri, 1, 1, "ChartView"); |
|
199 | 201 | qmlRegisterType<DeclarativeScatterSeries, 1>(uri, 1, 1, "ScatterSeries"); |
|
200 | 202 | qmlRegisterType<DeclarativeLineSeries, 1>(uri, 1, 1, "LineSeries"); |
|
201 | 203 | qmlRegisterType<DeclarativeSplineSeries, 1>(uri, 1, 1, "SplineSeries"); |
|
202 | 204 | qmlRegisterType<DeclarativeAreaSeries, 1>(uri, 1, 1, "AreaSeries"); |
|
203 | 205 | qmlRegisterType<DeclarativeBarSeries, 1>(uri, 1, 1, "BarSeries"); |
|
204 | 206 | qmlRegisterType<DeclarativeStackedBarSeries, 1>(uri, 1, 1, "StackedBarSeries"); |
|
205 | 207 | qmlRegisterType<DeclarativePercentBarSeries, 1>(uri, 1, 1, "PercentBarSeries"); |
|
206 | 208 | qmlRegisterType<DeclarativeHorizontalBarSeries, 1>(uri, 1, 1, "HorizontalBarSeries"); |
|
207 | 209 | qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 1>(uri, 1, 1, "HorizontalStackedBarSeries"); |
|
208 | 210 | qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 1>(uri, 1, 1, "HorizontalPercentBarSeries"); |
|
209 | 211 | qmlRegisterType<DeclarativePieSeries>(uri, 1, 1, "PieSeries"); |
|
210 | 212 | qmlRegisterType<DeclarativeBarSet>(uri, 1, 1, "BarSet"); |
|
211 | 213 | qmlRegisterType<QValueAxis>(uri, 1, 1, "ValueAxis"); |
|
212 | 214 | #ifndef QT_QREAL_IS_FLOAT |
|
213 | 215 | qmlRegisterType<QDateTimeAxis>(uri, 1, 1, "DateTimeAxis"); |
|
214 | 216 | #endif |
|
215 | 217 | qmlRegisterType<DeclarativeCategoryAxis>(uri, 1, 1, "CategoryAxis"); |
|
216 | 218 | qmlRegisterType<DeclarativeCategoryRange>(uri, 1, 1, "CategoryRange"); |
|
217 | 219 | qmlRegisterType<QBarCategoryAxis>(uri, 1, 1, "BarCategoryAxis"); |
|
218 | 220 | qmlRegisterUncreatableType<DeclarativeMargins>(uri, 1, 1, "Margins", |
|
219 | 221 | QLatin1String("Trying to create uncreatable: Margins.")); |
|
220 | 222 | |
|
221 | 223 | // QtCharts 1.2 |
|
222 | 224 | qmlRegisterType<DeclarativeChart, 2>(uri, 1, 2, "ChartView"); |
|
223 | 225 | qmlRegisterType<DeclarativeScatterSeries, 2>(uri, 1, 2, "ScatterSeries"); |
|
224 | 226 | qmlRegisterType<DeclarativeLineSeries, 2>(uri, 1, 2, "LineSeries"); |
|
225 | 227 | qmlRegisterType<DeclarativeSplineSeries, 2>(uri, 1, 2, "SplineSeries"); |
|
226 | 228 | qmlRegisterType<DeclarativeAreaSeries, 2>(uri, 1, 2, "AreaSeries"); |
|
227 | 229 | qmlRegisterType<DeclarativeBarSeries, 2>(uri, 1, 2, "BarSeries"); |
|
228 | 230 | qmlRegisterType<DeclarativeStackedBarSeries, 2>(uri, 1, 2, "StackedBarSeries"); |
|
229 | 231 | qmlRegisterType<DeclarativePercentBarSeries, 2>(uri, 1, 2, "PercentBarSeries"); |
|
230 | 232 | qmlRegisterType<DeclarativeHorizontalBarSeries, 2>(uri, 1, 2, "HorizontalBarSeries"); |
|
231 | 233 | qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 2>(uri, 1, 2, "HorizontalStackedBarSeries"); |
|
232 | 234 | qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 2>(uri, 1, 2, "HorizontalPercentBarSeries"); |
|
233 | 235 | |
|
234 | 236 | // QtCharts 1.3 |
|
235 | 237 | qmlRegisterType<DeclarativeChart, 3>(uri, 1, 3, "ChartView"); |
|
236 | 238 | qmlRegisterType<DeclarativePolarChart, 1>(uri, 1, 3, "PolarChartView"); |
|
237 | 239 | qmlRegisterType<DeclarativeSplineSeries, 3>(uri, 1, 3, "SplineSeries"); |
|
238 | 240 | qmlRegisterType<DeclarativeScatterSeries, 3>(uri, 1, 3, "ScatterSeries"); |
|
239 | 241 | qmlRegisterType<DeclarativeLineSeries, 3>(uri, 1, 3, "LineSeries"); |
|
240 | 242 | qmlRegisterType<DeclarativeAreaSeries, 3>(uri, 1, 3, "AreaSeries"); |
|
241 | 243 | qmlRegisterType<QLogValueAxis>(uri, 1, 3, "LogValueAxis"); |
|
242 | 244 | qmlRegisterType<DeclarativeBoxPlotSeries>(uri, 1, 3, "BoxPlotSeries"); |
|
243 | 245 | qmlRegisterType<DeclarativeBoxSet>(uri, 1, 3, "BoxSet"); |
|
244 | 246 | |
|
245 | 247 | // QtCharts 1.4 |
|
246 | 248 | qmlRegisterType<DeclarativeAreaSeries, 4>(uri, 1, 4, "AreaSeries"); |
|
247 | 249 | qmlRegisterType<DeclarativeBarSet, 2>(uri, 1, 4, "BarSet"); |
|
248 | 250 | qmlRegisterType<DeclarativeBoxPlotSeries, 1>(uri, 1, 4, "BoxPlotSeries"); |
|
249 | 251 | qmlRegisterType<DeclarativeBoxSet, 1>(uri, 1, 4, "BoxSet"); |
|
250 | 252 | qmlRegisterType<DeclarativePieSlice>(uri, 1, 4, "PieSlice"); |
|
251 | 253 | qmlRegisterType<DeclarativeScatterSeries, 4>(uri, 1, 4, "ScatterSeries"); |
|
252 | 254 | |
|
253 | 255 | // QtCharts 2.0 |
|
256 | qmlRegisterType<QHBoxPlotModelMapper>(uri, 2, 0, "HBoxPlotModelMapper"); | |
|
254 | 257 | qmlRegisterType<QVBoxPlotModelMapper>(uri, 2, 0, "VBoxPlotModelMapper"); |
|
255 | 258 | qmlRegisterUncreatableType<QBoxPlotModelMapper>(uri, 2, 0, "BoxPlotModelMapper", |
|
256 | 259 | QLatin1String("Trying to create uncreatable: BoxPlotModelMapper.")); |
|
257 | 260 | qmlRegisterType<DeclarativeChart, 4>(uri, 2, 0, "ChartView"); |
|
258 | 261 | qmlRegisterType<DeclarativeXYPoint>(uri, 2, 0, "XYPoint"); |
|
259 | 262 | qmlRegisterType<DeclarativeScatterSeries, 4>(uri, 2, 0, "ScatterSeries"); |
|
260 | 263 | qmlRegisterType<DeclarativeLineSeries, 3>(uri, 2, 0, "LineSeries"); |
|
261 | 264 | qmlRegisterType<DeclarativeSplineSeries, 3>(uri, 2, 0, "SplineSeries"); |
|
262 | 265 | qmlRegisterType<DeclarativeAreaSeries, 4>(uri, 2, 0, "AreaSeries"); |
|
263 | 266 | qmlRegisterType<DeclarativeBarSeries, 2>(uri, 2, 0, "BarSeries"); |
|
264 | 267 | qmlRegisterType<DeclarativeStackedBarSeries, 2>(uri, 2, 0, "StackedBarSeries"); |
|
265 | 268 | qmlRegisterType<DeclarativePercentBarSeries, 2>(uri, 2, 0, "PercentBarSeries"); |
|
266 | 269 | qmlRegisterType<DeclarativePieSeries>(uri, 2, 0, "PieSeries"); |
|
267 | 270 | qmlRegisterType<QPieSlice>(uri, 2, 0, "PieSlice"); |
|
268 | 271 | qmlRegisterType<DeclarativeBarSet, 2>(uri, 2, 0, "BarSet"); |
|
269 | 272 | qmlRegisterType<QHXYModelMapper>(uri, 2, 0, "HXYModelMapper"); |
|
270 | 273 | qmlRegisterType<QVXYModelMapper>(uri, 2, 0, "VXYModelMapper"); |
|
271 | 274 | qmlRegisterType<QHPieModelMapper>(uri, 2, 0, "HPieModelMapper"); |
|
272 | 275 | qmlRegisterType<QVPieModelMapper>(uri, 2, 0, "VPieModelMapper"); |
|
273 | 276 | qmlRegisterType<QHBarModelMapper>(uri, 2, 0, "HBarModelMapper"); |
|
274 | 277 | qmlRegisterType<QVBarModelMapper>(uri, 2, 0, "VBarModelMapper"); |
|
275 | 278 | qmlRegisterType<QValueAxis>(uri, 2, 0, "ValueAxis"); |
|
276 | 279 | #ifndef QT_QREAL_IS_FLOAT |
|
277 | 280 | qmlRegisterType<QDateTimeAxis>(uri, 2, 0, "DateTimeAxis"); |
|
278 | 281 | #endif |
|
279 | 282 | qmlRegisterType<DeclarativeCategoryAxis>(uri, 2, 0, "CategoryAxis"); |
|
280 | 283 | qmlRegisterType<DeclarativeCategoryRange>(uri, 2, 0, "CategoryRange"); |
|
281 | 284 | qmlRegisterType<QBarCategoryAxis>(uri, 2, 0, "BarCategoryAxis"); |
|
282 | 285 | qmlRegisterType<DeclarativePolarChart, 1>(uri, 2, 0, "PolarChartView"); |
|
283 | 286 | qmlRegisterType<QLogValueAxis, 1>(uri, 2, 0, "LogValueAxis"); |
|
284 | 287 | qmlRegisterType<DeclarativeBoxPlotSeries, 1>(uri, 2, 0, "BoxPlotSeries"); |
|
285 | 288 | qmlRegisterType<DeclarativeBoxSet, 1>(uri, 2, 0, "BoxSet"); |
|
286 | 289 | qmlRegisterType<DeclarativeHorizontalBarSeries, 2>(uri, 2, 0, "HorizontalBarSeries"); |
|
287 | 290 | qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 2>(uri, 2, 0, "HorizontalStackedBarSeries"); |
|
288 | 291 | qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 2>(uri, 2, 0, "HorizontalPercentBarSeries"); |
|
289 | 292 | qmlRegisterType<DeclarativePieSlice>(uri, 2, 0, "PieSlice"); |
|
290 | 293 | qmlRegisterUncreatableType<QLegend>(uri, 2, 0, "Legend", |
|
291 | 294 | QLatin1String("Trying to create uncreatable: Legend.")); |
|
292 | 295 | qmlRegisterUncreatableType<QXYSeries>(uri, 2, 0, "XYSeries", |
|
293 | 296 | QLatin1String("Trying to create uncreatable: XYSeries.")); |
|
294 | 297 | qmlRegisterUncreatableType<QAbstractItemModel>(uri, 2, 0, "AbstractItemModel", |
|
295 | 298 | QLatin1String("Trying to create uncreatable: AbstractItemModel.")); |
|
296 | 299 | qmlRegisterUncreatableType<QXYModelMapper>(uri, 2, 0, "XYModelMapper", |
|
297 | 300 | QLatin1String("Trying to create uncreatable: XYModelMapper.")); |
|
298 | 301 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 2, 0, "PieModelMapper", |
|
299 | 302 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); |
|
300 | 303 | qmlRegisterUncreatableType<QBarModelMapper>(uri, 2, 0, "BarModelMapper", |
|
301 | 304 | QLatin1String("Trying to create uncreatable: BarModelMapper.")); |
|
302 | 305 | qmlRegisterUncreatableType<QAbstractSeries>(uri, 2, 0, "AbstractSeries", |
|
303 | 306 | QLatin1String("Trying to create uncreatable: AbstractSeries.")); |
|
304 | 307 | qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 2, 0, "AbstractBarSeries", |
|
305 | 308 | QLatin1String("Trying to create uncreatable: AbstractBarSeries.")); |
|
306 | 309 | qmlRegisterUncreatableType<QAbstractAxis>(uri, 2, 0, "AbstractAxis", |
|
307 | 310 | QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead.")); |
|
308 | 311 | qmlRegisterUncreatableType<QBarSet>(uri, 2, 0, "BarSetBase", |
|
309 | 312 | QLatin1String("Trying to create uncreatable: BarsetBase.")); |
|
310 | 313 | qmlRegisterUncreatableType<QPieSeries>(uri, 2, 0, "QPieSeries", |
|
311 | 314 | QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead.")); |
|
312 | 315 | qmlRegisterUncreatableType<DeclarativeAxes>(uri, 2, 0, "DeclarativeAxes", |
|
313 | 316 | QLatin1String("Trying to create uncreatable: DeclarativeAxes.")); |
|
314 | 317 | qmlRegisterUncreatableType<DeclarativeMargins>(uri, 2, 0, "Margins", |
|
315 | 318 | QLatin1String("Trying to create uncreatable: Margins.")); |
|
316 | 319 | |
|
317 | 320 | // QtCharts 2.1 |
|
318 | 321 | qmlRegisterType<DeclarativeCategoryAxis, 1>(uri, 2, 1, "CategoryAxis"); |
|
319 | 322 | qmlRegisterUncreatableType<QAbstractAxis>(uri, 2, 1, "AbstractAxis", |
|
320 | 323 | QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead.")); |
|
321 | 324 | qmlRegisterType<DeclarativeChart, 5>(uri, 2, 1, "ChartView"); |
|
322 | 325 | qmlRegisterType<DeclarativeScatterSeries, 5>(uri, 2, 1, "ScatterSeries"); |
|
323 | 326 | qmlRegisterType<DeclarativeLineSeries, 4>(uri, 2, 1, "LineSeries"); |
|
324 | 327 | qmlRegisterType<DeclarativeSplineSeries, 4>(uri, 2, 1, "SplineSeries"); |
|
325 | 328 | } |
|
326 | 329 | |
|
327 | 330 | }; |
|
328 | 331 | |
|
329 | 332 | QT_CHARTS_END_NAMESPACE |
|
330 | 333 | |
|
331 | 334 | #include "chartsqml2_plugin.moc" |
|
332 | 335 | |
|
333 | 336 | QT_CHARTS_USE_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now