##// END OF EJS Templates
Minor doc fix in model mappers
Tero Ahola -
r1519:446b991a9d20
parent child
Show More
@@ -1,232 +1,232
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "qhxymodelmapper.h"
22 22
23 23 QTCOMMERCIALCHART_BEGIN_NAMESPACE
24 24
25 25 /*!
26 26 \class QHXYModelMapper
27 27 \mainclass
28 28
29 29 Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
30 30 Horizontal model mapper is used to create a connection between QXYSeries and QAbstractItemModel derived model object.
31 31 It is possible to use both QAbstractItemModel and QXYSeries model API. QXYModelMapper makes sure that QXYSeries and the model are kept in sync.
32 32 NOTE: used model has to support adding/removing rows/columns and modifying the data of the cells.
33 33 */
34 34 /*!
35 35 \qmlclass HXYModelMapper QHXYModelMapper
36 36
37 37 HXYModelMapper allows you to use your own QAbstractItemModel derived model with data in rows as a data source
38 38 for XYSeries based series. It is possible to use both QAbstractItemModel and XYSeries data API to manipulate data.
39 39 HXYModelMapper keeps the series and the model in sync.
40 40 */
41 41
42 42 /*!
43 43 \property QHXYModelMapper::series
44 44 \brief Defines the QXYSeries object that is used by the mapper.
45 45 All the data in the series is discarded when it is set to the mapper.
46 46 When new series is specified the old series is disconnected (it preserves its data)
47 47 */
48 48 /*!
49 49 \qmlproperty XYSeries HXYModelMapper::series
50 Defines the QXYSeries object that is used by the mapper. All the data in the series is discarded when it is set to
50 Defines the XYSeries object that is used by the mapper. All the data in the series is discarded when it is set to
51 51 the mapper. When new series is specified the old series is disconnected (it preserves its data).
52 52 */
53 53
54 54 /*!
55 55 \property QHXYModelMapper::model
56 56 \brief Defines the model that is used by the mapper.
57 57 */
58 58 /*!
59 59 \qmlproperty SomeModel HXYModelMapper::model
60 60 The QAbstractItemModel based model that is used by the mapper. You need to implement the model and expose it to
61 61 QML as shown in \l {QML Custom Model} demo application. NOTE: the model has to support adding/removing rows/columns
62 62 and modifying the data of the cells.
63 63 */
64 64
65 65 /*!
66 66 \property QHXYModelMapper::xRow
67 67 \brief Defines which row of the model is kept in sync with the x values of the QXYSeries
68 68 Default value is: -1 (invalid mapping)
69 69 */
70 70 /*!
71 71 \qmlproperty int HXYModelMapper::xRow
72 Defines which row of the model is kept in sync with the x values of the QXYSeries. Default value is -1 (invalid
72 Defines which row of the model is kept in sync with the x values of the series. Default value is -1 (invalid
73 73 mapping).
74 74 */
75 75
76 76 /*!
77 77 \property QHXYModelMapper::yRow
78 78 \brief Defines which row of the model is kept in sync with the y values of the QXYSeries
79 79 Default value is: -1 (invalid mapping)
80 80 */
81 81 /*!
82 82 \qmlproperty int HXYModelMapper::yRow
83 Defines which row of the model is kept in sync with the y values of the QXYSeries. Default value is -1
83 Defines which row of the model is kept in sync with the y values of the series. Default value is -1
84 84 (invalid mapping).
85 85 */
86 86
87 87 /*!
88 88 \property QHXYModelMapper::firstColumn
89 89 \brief Defines which column of the model contains the data for the first point of the series.
90 90 Minimal and default value is: 0
91 91 */
92 92 /*!
93 93 \qmlproperty int HXYModelMapper::firstColumn
94 94 Defines which column of the model contains the data for the first point of the series.
95 95 The default value is 0.
96 96 */
97 97
98 98 /*!
99 99 \property QHXYModelMapper::columnCount
100 100 \brief Defines the number of columns of the model that are mapped as the data for series
101 101 Minimal and default value is: -1 (count limited by the number of columns in the model)
102 102 */
103 103 /*!
104 104 \qmlproperty int HXYModelMapper::columnCount
105 105 Defines the number of columns of the model that are mapped as the data for series. The default value is
106 106 -1 (count limited by the number of columns in the model)
107 107 */
108 108
109 109 /*!
110 110 \fn void QHXYModelMapper::seriesReplaced()
111 111
112 112 Emitted when the series to which mapper is connected to has changed.
113 113 */
114 114
115 115 /*!
116 116 \fn void QHXYModelMapper::modelReplaced()
117 117
118 118 Emitted when the model to which mapper is connected to has changed.
119 119 */
120 120
121 121 /*!
122 122 \fn void QHXYModelMapper::xRowChanged()
123 123
124 124 Emitted when the xRow has changed.
125 125 */
126 126
127 127 /*!
128 128 \fn void QHXYModelMapper::yRowChanged()
129 129
130 130 Emitted when the yRow has changed.
131 131 */
132 132
133 133 /*!
134 134 \fn void QHXYModelMapper::firstColumnChanged()
135 135 Emitted when the firstColumn has changed.
136 136 */
137 137
138 138 /*!
139 139 \fn void QHXYModelMapper::columnCountChanged()
140 140 Emitted when the columnCount has changed.
141 141 */
142 142
143 143 /*!
144 144 Constructs a mapper object which is a child of \a parent.
145 145 */
146 146 QHXYModelMapper::QHXYModelMapper(QObject *parent) :
147 147 QXYModelMapper(parent)
148 148 {
149 149 QXYModelMapper::setOrientation(Qt::Horizontal);
150 150 }
151 151
152 152 QAbstractItemModel* QHXYModelMapper::model() const
153 153 {
154 154 return QXYModelMapper::model();
155 155 }
156 156
157 157 void QHXYModelMapper::setModel(QAbstractItemModel *model)
158 158 {
159 159 if (model != QXYModelMapper::model()) {
160 160 QXYModelMapper::setModel(model);
161 161 emit modelReplaced();
162 162 }
163 163 }
164 164
165 165 QXYSeries* QHXYModelMapper::series() const
166 166 {
167 167 return QXYModelMapper::series();
168 168 }
169 169
170 170 void QHXYModelMapper::setSeries(QXYSeries *series)
171 171 {
172 172 if (series != QXYModelMapper::series()) {
173 173 QXYModelMapper::setSeries(series);
174 174 emit seriesReplaced();
175 175 }
176 176 }
177 177
178 178 int QHXYModelMapper::xRow() const
179 179 {
180 180 return QXYModelMapper::xSection();
181 181 }
182 182
183 183 void QHXYModelMapper::setXRow(int xRow)
184 184 {
185 185 if (xRow != xSection()) {
186 186 return QXYModelMapper::setXSection(xRow);
187 187 emit xRowChanged();
188 188 }
189 189 }
190 190
191 191 int QHXYModelMapper::yRow() const
192 192 {
193 193 return QXYModelMapper::ySection();
194 194 }
195 195
196 196 void QHXYModelMapper::setYRow(int yRow)
197 197 {
198 198 if (yRow != ySection()) {
199 199 return QXYModelMapper::setYSection(yRow);
200 200 emit yRowChanged();
201 201 }
202 202 }
203 203
204 204 int QHXYModelMapper::firstColumn() const
205 205 {
206 206 return first();
207 207 }
208 208
209 209 void QHXYModelMapper::setFirstColumn(int firstColumn)
210 210 {
211 211 if (firstColumn != first()) {
212 212 setFirst(firstColumn);
213 213 emit firstColumnChanged();
214 214 }
215 215 }
216 216
217 217 int QHXYModelMapper::columnCount() const
218 218 {
219 219 return count();
220 220 }
221 221
222 222 void QHXYModelMapper::setColumnCount(int columnCount)
223 223 {
224 224 if (columnCount != count()) {
225 225 setCount(columnCount);
226 226 emit firstColumnChanged();
227 227 }
228 228 }
229 229
230 230 #include "moc_qhxymodelmapper.cpp"
231 231
232 232 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,232 +1,232
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "qvxymodelmapper.h"
22 22
23 23 QTCOMMERCIALCHART_BEGIN_NAMESPACE
24 24
25 25 /*!
26 26 \class QVXYModelMapper
27 27 \mainclass
28 28
29 29 Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
30 30 Vertical model mapper is used to create a connection between QXYSeries and QAbstractItemModel derived model object.
31 31 It is possible to use both QAbstractItemModel and QXYSeries model API. QXYModelMapper makes sure that QXYSeries and the model are kept in sync.
32 32 NOTE: used model has to support adding/removing rows/columns and modifying the data of the cells.
33 33 */
34 34 /*!
35 35 \qmlclass VXYModelMapper QHXYModelMapper
36 36
37 37 VXYModelMapper allows you to use your own QAbstractItemModel derived model with data in columns as a data source
38 38 for XYSeries based series. It is possible to use both QAbstractItemModel and XYSeries data API to manipulate data.
39 39 VYModelMapper keeps the series and the model in sync.
40 40 */
41 41
42 42 /*!
43 43 \property QVXYModelMapper::series
44 44 \brief Defines the QXYSeries object that is used by the mapper.
45 45 All the data in the series is discarded when it is set to the mapper.
46 46 When new series is specified the old series is disconnected (it preserves its data)
47 47 */
48 48 /*!
49 49 \qmlproperty XYSeries VXYModelMapper::series
50 Defines the QXYSeries object that is used by the mapper. All the data in the series is discarded when it is set to
50 Defines the XYSeries object that is used by the mapper. All the data in the series is discarded when it is set to
51 51 the mapper. When new series is specified the old series is disconnected (it preserves its data).
52 52 */
53 53
54 54 /*!
55 55 \property QVXYModelMapper::model
56 56 \brief Defines the model that is used by the mapper.
57 57 */
58 58 /*!
59 59 \qmlproperty SomeModel VXYModelMapper::model
60 60 The QAbstractItemModel based model that is used by the mapper. You need to implement the model and expose it to
61 61 QML as shown in \l {QML Custom Model} demo application. NOTE: the model has to support adding/removing rows/columns
62 62 and modifying the data of the cells.
63 63 */
64 64
65 65 /*!
66 66 \property QVXYModelMapper::xColumn
67 67 \brief Defines which column of the model is kept in sync with the x values of QXYSeries
68 68 Default value is: -1 (invalid mapping)
69 69 */
70 70 /*!
71 71 \qmlproperty int VXYModelMapper::xColumn
72 Defines which column of the model is kept in sync with the x values of XYSeries. Default value is -1 (invalid
72 Defines which column of the model is kept in sync with the x values of the series. Default value is -1 (invalid
73 73 mapping).
74 74 */
75 75
76 76 /*!
77 77 \property QVXYModelMapper::yColumn
78 78 \brief Defines which column of the model is kept in sync with the y values of QXYSeries
79 79 Default value is: -1 (invalid mapping)
80 80 */
81 81 /*!
82 82 \qmlproperty int VXYModelMapper::yColumn
83 Defines which column of the model is kept in sync with the y values of QXYSeries. Default value is -1 (invalid
83 Defines which column of the model is kept in sync with the y values of the series. Default value is -1 (invalid
84 84 mapping).
85 85 */
86 86
87 87 /*!
88 88 \property QVXYModelMapper::firstRow
89 89 \brief Defines which row of the model contains the data for the first point of the series.
90 90 Minimal and default value is: 0
91 91 */
92 92 /*!
93 93 \qmlproperty int VXYModelMapper::firstRow
94 94 Defines which row of the model contains the data for the first point of the series.
95 95 The default value is 0.
96 96 */
97 97
98 98 /*!
99 99 \property QVXYModelMapper::rowCount
100 100 \brief Defines the number of rows of the model that are mapped as the data for series
101 101 Minimal and default value is: -1 (count limited by the number of rows in the model)
102 102 */
103 103 /*!
104 104 \qmlproperty int VXYModelMapper::columnCount
105 105 Defines the number of rows of the model that are mapped as the data for series. The default value is
106 106 -1 (count limited by the number of rows in the model).
107 107 */
108 108
109 109 /*!
110 110 \fn void QVXYModelMapper::seriesReplaced()
111 111
112 112 Emitted when the series to which mapper is connected to has changed.
113 113 */
114 114
115 115 /*!
116 116 \fn void QVXYModelMapper::modelReplaced()
117 117
118 118 Emitted when the model to which mapper is connected to has changed.
119 119 */
120 120
121 121 /*!
122 122 \fn void QVXYModelMapper::xColumnChanged()
123 123
124 124 Emitted when the xColumn has changed.
125 125 */
126 126
127 127 /*!
128 128 \fn void QVXYModelMapper::yColumnChanged()
129 129
130 130 Emitted when the yColumn has changed.
131 131 */
132 132
133 133 /*!
134 134 \fn void QVXYModelMapper::firstRowChanged()
135 135 Emitted when the firstRow has changed.
136 136 */
137 137
138 138 /*!
139 139 \fn void QVXYModelMapper::rowCountChanged()
140 140 Emitted when the rowCount has changed.
141 141 */
142 142
143 143 /*!
144 144 Constructs a mapper object which is a child of \a parent.
145 145 */
146 146 QVXYModelMapper::QVXYModelMapper(QObject *parent) :
147 147 QXYModelMapper(parent)
148 148 {
149 149 QXYModelMapper::setOrientation(Qt::Vertical);
150 150 }
151 151
152 152 QAbstractItemModel* QVXYModelMapper::model() const
153 153 {
154 154 return QXYModelMapper::model();
155 155 }
156 156
157 157 void QVXYModelMapper::setModel(QAbstractItemModel *model)
158 158 {
159 159 if (model != QXYModelMapper::model()) {
160 160 QXYModelMapper::setModel(model);
161 161 emit modelReplaced();
162 162 }
163 163 }
164 164
165 165 QXYSeries* QVXYModelMapper::series() const
166 166 {
167 167 return QXYModelMapper::series();
168 168 }
169 169
170 170 void QVXYModelMapper::setSeries(QXYSeries *series)
171 171 {
172 172 if (series != QXYModelMapper::series()) {
173 173 QXYModelMapper::setSeries(series);
174 174 emit seriesReplaced();
175 175 }
176 176 }
177 177
178 178 int QVXYModelMapper::xColumn() const
179 179 {
180 180 return QXYModelMapper::xSection();
181 181 }
182 182
183 183 void QVXYModelMapper::setXColumn(int xColumn)
184 184 {
185 185 if (xColumn != xSection()) {
186 186 return QXYModelMapper::setXSection(xColumn);
187 187 emit xColumnChanged();
188 188 }
189 189 }
190 190
191 191 int QVXYModelMapper::yColumn() const
192 192 {
193 193 return QXYModelMapper::ySection();
194 194 }
195 195
196 196 void QVXYModelMapper::setYColumn(int yColumn)
197 197 {
198 198 if (yColumn != ySection()) {
199 199 return QXYModelMapper::setYSection(yColumn);
200 200 emit yColumnChanged();
201 201 }
202 202 }
203 203
204 204 int QVXYModelMapper::firstRow() const
205 205 {
206 206 return first();
207 207 }
208 208
209 209 void QVXYModelMapper::setFirstRow(int firstRow)
210 210 {
211 211 if (firstRow != first()) {
212 212 setFirst(firstRow);
213 213 emit firstRowChanged();
214 214 }
215 215 }
216 216
217 217 int QVXYModelMapper::rowCount() const
218 218 {
219 219 return count();
220 220 }
221 221
222 222 void QVXYModelMapper::setRowCount(int rowCount)
223 223 {
224 224 if (rowCount != count()) {
225 225 setCount(rowCount);
226 226 emit firstRowChanged();
227 227 }
228 228 }
229 229
230 230 #include "moc_qvxymodelmapper.cpp"
231 231
232 232 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now