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