##// END OF EJS Templates
Remove QML Custom Model from documentation...
Titta Heikkala -
r2633:f1cc99933181
parent child
Show More
@@ -1,253 +1,253
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "qvboxplotmodelmapper.h"
22 22
23 23 QTCOMMERCIALCHART_BEGIN_NAMESPACE
24 24
25 25 /*!
26 26 \class QVBoxPlotModelMapper
27 27 \brief Vertical model mapper for bar series
28 28 \mainclass
29 29
30 30 Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
31 31 Vertical model mapper is used to create a connection between QBoxPlotSeries and QAbstractItemModel derived model object.
32 32 Model mapper maintains equal size of all the QBoxSets.
33 33 Note: used model has to support adding/removing rows/columns and modifying the data of the cells.
34 34 */
35 35 /*!
36 36 \qmlclass VBoxPlotModelMapper
37 37 \mainclass
38 38
39 39 VBoxPlotModelMapper allows you to use your own QAbstractItemModel derived model with data in columns as a data source
40 40 for any box-and-whiskers series. It is possible to use both QAbstractItemModel and box-and-whiskers series data API to
41 41 manipulate data.
42 42 VBoxPlotModelMapper keeps the series and the model in sync.
43 43
44 44 The following QML example would create a box-and-whiskers series with three box sets (assuming the
45 45 model has at least four columns). Each box set would contain data starting from row 1. The name of a set would be
46 46 defined by the horizontal header (of the column).
47 47 \code
48 48 BarSeries {
49 49 VBarModelMapper {
50 50 model: myCustomModel // QAbstractItemModel derived implementation
51 51 firstBoxSetColumn: 1
52 52 lastBoxSetColumn: 3
53 53 firstRow: 1
54 54 }
55 55 }
56 56 \endcode
57 57 */
58 58
59 59 /*!
60 60 \property QVBoxPlotModelMapper::series
61 61 \brief Defines the QBoxPlotSeries object that is used by the mapper.
62 62
63 63 All the data in the series is discarded when it is set to the mapper.
64 64 When new series is specified the old series is disconnected (it preserves its data)
65 65 */
66 66 /*!
67 67 \qmlproperty AbstractBarSeries VBarModelMapper::series
68 68 Defines the AbstractBarSeries based object that is used by the mapper. All the data in the series is discarded when it is
69 69 set to the mapper. When new series is specified the old series is disconnected (it preserves its data).
70 70 */
71 71
72 72 /*!
73 73 \property QVBoxPlotModelMapper::model
74 74 \brief Defines the model that is used by the mapper.
75 75 */
76 76 /*!
77 77 \qmlproperty SomeModel VBarModelMapper::model
78 The QAbstractItemModel based model that is used by the mapper. You need to implement the model and expose it to
79 QML as shown in \l {QML Custom Model} demo application. Note: the model has to support adding/removing rows/columns
80 and modifying the data of the cells.
78 The QAbstractItemModel based model that is used by the mapper. You need to implement the model
79 and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying
80 the data of the cells.
81 81 */
82 82
83 83 /*!
84 84 \property QVBoxPlotModelMapper::firstBoxSetColumn
85 85 \brief Defines which column of the model is used as the data source for the first box-and-whiskers set.
86 86
87 87 Default value is: -1 (invalid mapping)
88 88 */
89 89 /*!
90 90 \qmlproperty int VBarModelMapper::firstBoxSetColumn
91 91 Defines which column of the model is used as the data source for the first box-and-whiskers set. Default value
92 92 is: -1 (invalid mapping).
93 93 */
94 94
95 95 /*!
96 96 \property QVBoxPlotModelMapper::lastBoxSetColumn
97 97 \brief Defines which column of the model is used as the data source for the last box-and-whiskers set.
98 98
99 99 Default value is: -1 (invalid mapping)
100 100 */
101 101 /*!
102 102 \qmlproperty int VBarModelMapper::lastBoxSetColumn
103 103 Defines which column of the model is used as the data source for the last box-and-whiskers set. Default
104 104 value is: -1 (invalid mapping).
105 105 */
106 106
107 107 /*!
108 108 \property QVBoxPlotModelMapper::firstRow
109 109 \brief Defines which row of the model contains the first values of the QBoxSets in the series.
110 110
111 111 Minimal and default value is: 0
112 112 */
113 113 /*!
114 114 \qmlproperty int VBoxPlotModelMapper::firstRow
115 115 Defines which row of the model contains the first values of the QBoxSets in the series.
116 116 The default value is 0.
117 117 */
118 118
119 119 /*!
120 120 \property QVBoxPlotModelMapper::rowCount
121 121 \brief Defines the number of rows of the model that are mapped as the data for QBoxPlotSeries
122 122
123 123 Minimal and default value is: -1 (count limited by the number of rows in the model)
124 124 */
125 125 /*!
126 126 \qmlproperty int VBoxModelMapper::rowCount
127 127 Defines the number of rows of the model that are mapped as the data for QBoxPlotSeries. The default value is
128 128 -1 (count limited by the number of rows in the model)
129 129 */
130 130
131 131 /*!
132 132 \fn void QVBoxPlotModelMapper::seriesReplaced()
133 133
134 134 Emitted when the series to which mapper is connected to has changed.
135 135 */
136 136
137 137 /*!
138 138 \fn void QVBoxPlotModelMapper::modelReplaced()
139 139
140 140 Emitted when the model to which mapper is connected to has changed.
141 141 */
142 142
143 143 /*!
144 144 \fn void QVBoxPlotModelMapper::firstBoxSetColumnChanged()
145 145 Emitted when the firstBoxSetColumn has changed.
146 146 */
147 147
148 148 /*!
149 149 \fn void QVBoxPlotModelMapper::lastBoxSetColumnChanged()
150 150 Emitted when the lastBoxSetColumn has changed.
151 151 */
152 152
153 153 /*!
154 154 \fn void QVBoxPlotModelMapper::firstRowChanged()
155 155 Emitted when the firstRow has changed.
156 156 */
157 157
158 158 /*!
159 159 \fn void QVBoxPlotModelMapper::rowCountChanged()
160 160 Emitted when the rowCount has changed.
161 161 */
162 162
163 163 /*!
164 164 Constructs a mapper object which is a child of \a parent.
165 165 */
166 166 QVBoxPlotModelMapper::QVBoxPlotModelMapper(QObject *parent) :
167 167 QBoxPlotModelMapper(parent)
168 168 {
169 169 QBoxPlotModelMapper::setOrientation(Qt::Vertical);
170 170 }
171 171
172 172 QAbstractItemModel *QVBoxPlotModelMapper::model() const
173 173 {
174 174 return QBoxPlotModelMapper::model();
175 175 }
176 176
177 177 void QVBoxPlotModelMapper::setModel(QAbstractItemModel *model)
178 178 {
179 179 if (model != QBoxPlotModelMapper::model()) {
180 180 QBoxPlotModelMapper::setModel(model);
181 181 emit modelReplaced();
182 182 }
183 183 }
184 184
185 185 QBoxPlotSeries *QVBoxPlotModelMapper::series() const
186 186 {
187 187 return QBoxPlotModelMapper::series();
188 188 }
189 189
190 190 void QVBoxPlotModelMapper::setSeries(QBoxPlotSeries *series)
191 191 {
192 192 if (series != QBoxPlotModelMapper::series()) {
193 193 QBoxPlotModelMapper::setSeries(series);
194 194 emit seriesReplaced();
195 195 }
196 196 }
197 197
198 198 int QVBoxPlotModelMapper::firstBoxSetColumn() const
199 199 {
200 200 return QBoxPlotModelMapper::firstBoxSetSection();
201 201 }
202 202
203 203 void QVBoxPlotModelMapper::setFirstBoxSetColumn(int firstBoxSetColumn)
204 204 {
205 205 if (firstBoxSetColumn != firstBoxSetSection()) {
206 206 QBoxPlotModelMapper::setFirstBoxSetSection(firstBoxSetColumn);
207 207 emit firstBoxSetColumnChanged();
208 208 }
209 209 }
210 210
211 211 int QVBoxPlotModelMapper::lastBoxSetColumn() const
212 212 {
213 213 return QBoxPlotModelMapper::lastBoxSetSection();
214 214 }
215 215
216 216 void QVBoxPlotModelMapper::setLastBoxSetColumn(int lastBoxSetColumn)
217 217 {
218 218 if (lastBoxSetColumn != lastBoxSetSection()) {
219 219 QBoxPlotModelMapper::setLastBoxSetSection(lastBoxSetColumn);
220 220 emit lastBoxSetColumnChanged();
221 221 }
222 222 }
223 223
224 224 int QVBoxPlotModelMapper::firstRow() const
225 225 {
226 226 return QBoxPlotModelMapper::first();
227 227 }
228 228
229 229 void QVBoxPlotModelMapper::setFirstRow(int firstRow)
230 230 {
231 231 if (firstRow != first()) {
232 232 QBoxPlotModelMapper::setFirst(firstRow);
233 233 emit firstRowChanged();
234 234 }
235 235 }
236 236
237 237 int QVBoxPlotModelMapper::rowCount() const
238 238 {
239 239 return QBoxPlotModelMapper::count();
240 240 }
241 241
242 242 void QVBoxPlotModelMapper::setRowCount(int rowCount)
243 243 {
244 244 if (rowCount != count()) {
245 245 QBoxPlotModelMapper::setCount(rowCount);
246 246 emit rowCountChanged();
247 247 }
248 248 }
249 249
250 250 #include "moc_qvboxplotmodelmapper.cpp"
251 251
252 252 QTCOMMERCIALCHART_END_NAMESPACE
253 253
General Comments 0
You need to be logged in to leave comments. Login now