##// END OF EJS Templates
QXYModelMapper removed from the docs
Marek Rosa -
r1507:4d1b1b063da8
parent child
Show More
@@ -75,7 +75,7 Rectangle {
75 75 model: customModel
76 76 xRow: 0
77 77 yRow: 1
78 first: 2
78 firstColumn: 2
79 79 }
80 80 }
81 81 //![4]
@@ -87,7 +87,7 Rectangle {
87 87 model: customModel
88 88 xRow: 0
89 89 yRow: 2
90 first: 2
90 firstColumn: 2
91 91 }
92 92 }
93 93
@@ -98,7 +98,7 Rectangle {
98 98 model: customModel
99 99 xRow: 0
100 100 yRow: 3
101 first: 2
101 firstColumn: 2
102 102 }
103 103 }
104 104
@@ -109,7 +109,7 Rectangle {
109 109 model: customModel
110 110 xRow: 0
111 111 yRow: 4
112 first: 2
112 firstColumn: 2
113 113 }
114 114 }
115 115
@@ -120,7 +120,7 Rectangle {
120 120 model: customModel
121 121 xRow: 0
122 122 yRow: 5
123 first: 2
123 firstColumn: 2
124 124 }
125 125 }
126 126
@@ -52,11 +52,11
52 52 </td>
53 53 <td valign="top">
54 54 <ul>
55 <li><a href="qxyseries.html">QXYSeries</a></li>
55 56 <li><a href="qlineseries.html">QLineSeries</a></li>
56 57 <li><a href="qareaseries.html">QAreaSeries</a></li>
57 58 <li><a href="qscatterseries.html">QScatterSeries</a></li>
58 59 <li><a href="qsplineseries.html">QSplineSeries</a></li>
59 <li><a href="qxymodelmapper.html">QXYModelMapper</a></li>
60 60 <li><a href="qhxymodelmapper.html">QHXYModelMapper</a></li>
61 61 <li><a href="qvxymodelmapper.html">QVXYModelMapper</a></li>
62 62 </ul>
@@ -24,7 +24,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE
24 24
25 25 /*!
26 26 \class QHXYModelMapper
27 \brief part of QtCommercial chart API.
28 27 \mainclass
29 28
30 29 Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
@@ -34,6 +33,19 QTCOMMERCIALCHART_BEGIN_NAMESPACE
34 33 */
35 34
36 35 /*!
36 \property QHXYModelMapper::series
37 \brief Defines the QXYSeries object that is used by the mapper.
38
39 All the data in the series is discarded when it is set to the mapper.
40 When new series is specified the old series is disconnected (it preserves its data)
41 */
42
43 /*!
44 \property QHXYModelMapper::model
45 \brief Defines the model that is used by the mapper.
46 */
47
48 /*!
37 49 \property QHXYModelMapper::xRow
38 50 \brief Defines which row of the model is kept in sync with the x values of the QXYSeries
39 51 Default value is: -1 (invalid mapping)
@@ -47,6 +59,40 QTCOMMERCIALCHART_BEGIN_NAMESPACE
47 59 */
48 60
49 61 /*!
62 \property QHXYModelMapper::firstColumn
63 \brief Defines which column of the model contains the data for the first point of the series.
64 Minimal and default value is: 0
65 */
66 /*!
67 \qmlproperty int QHXYModelMapper::firstColumn
68 Defines which column of the model contains the data for the first point of the series.
69 The default value is 0.
70 */
71
72 /*!
73 \property QHXYModelMapper::columnCount
74 \brief Defines the number of columns of the model that are mapped as the data for series
75 Minimal and default value is: -1 (count limited by the number of columns in the model)
76 */
77 /*!
78 \qmlproperty int QHXYModelMapper::columnCount
79 Defines the number of columns of the model that are mapped as the data for series. The default value is
80 -1 (count limited by the number of columns in the model)
81 */
82
83 /*!
84 \fn void QHXYModelMapper::seriesReplaced()
85
86 Emitted when the series to which mapper is connected to has changed.
87 */
88
89 /*!
90 \fn void QHXYModelMapper::modelReplaced()
91
92 Emitted when the model to which mapper is connected to has changed.
93 */
94
95 /*!
50 96 \fn void QHXYModelMapper::xRowChanged()
51 97
52 98 Emitted when the xRow has changed.
@@ -59,6 +105,16 QTCOMMERCIALCHART_BEGIN_NAMESPACE
59 105 */
60 106
61 107 /*!
108 \fn void QHXYModelMapper::firstColumnChanged()
109 Emitted when the firstColumn has changed.
110 */
111
112 /*!
113 \fn void QHXYModelMapper::columnCountChanged()
114 Emitted when the columnCount has changed.
115 */
116
117 /*!
62 118 Constructs a mapper object which is a child of \a parent.
63 119 */
64 120 QHXYModelMapper::QHXYModelMapper(QObject *parent) :
@@ -67,6 +123,32 QHXYModelMapper::QHXYModelMapper(QObject *parent) :
67 123 QXYModelMapper::setOrientation(Qt::Horizontal);
68 124 }
69 125
126 QAbstractItemModel* QHXYModelMapper::model() const
127 {
128 return QXYModelMapper::model();
129 }
130
131 void QHXYModelMapper::setModel(QAbstractItemModel *model)
132 {
133 if (model != QXYModelMapper::model()) {
134 QXYModelMapper::setModel(model);
135 emit modelReplaced();
136 }
137 }
138
139 QXYSeries* QHXYModelMapper::series() const
140 {
141 return QXYModelMapper::series();
142 }
143
144 void QHXYModelMapper::setSeries(QXYSeries *series)
145 {
146 if (series != QXYModelMapper::series()) {
147 QXYModelMapper::setSeries(series);
148 emit seriesReplaced();
149 }
150 }
151
70 152 int QHXYModelMapper::xRow() const
71 153 {
72 154 return QXYModelMapper::xSection();
@@ -93,6 +175,32 void QHXYModelMapper::setYRow(int yRow)
93 175 }
94 176 }
95 177
178 int QHXYModelMapper::firstColumn() const
179 {
180 return first();
181 }
182
183 void QHXYModelMapper::setFirstColumn(int firstColumn)
184 {
185 if (firstColumn != first()) {
186 setFirst(firstColumn);
187 emit firstColumnChanged();
188 }
189 }
190
191 int QHXYModelMapper::columnCount() const
192 {
193 return count();
194 }
195
196 void QHXYModelMapper::setColumnCount(int columnCount)
197 {
198 if (columnCount != count()) {
199 setCount(columnCount);
200 emit firstColumnChanged();
201 }
202 }
203
96 204 #include "moc_qhxymodelmapper.cpp"
97 205
98 206 QTCOMMERCIALCHART_END_NAMESPACE
@@ -28,11 +28,21 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 28 class QTCOMMERCIALCHART_EXPORT QHXYModelMapper : public QXYModelMapper
29 29 {
30 30 Q_OBJECT
31 Q_PROPERTY(QXYSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
32 Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
31 33 Q_PROPERTY(int xRow READ xRow WRITE setXRow NOTIFY xRowChanged)
32 34 Q_PROPERTY(int yRow READ yRow WRITE setYRow NOTIFY yRowChanged)
35 Q_PROPERTY(int firstColumn READ firstColumn WRITE setFirstColumn NOTIFY firstColumnChanged)
36 Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount NOTIFY columnCountChanged)
33 37
34 38 public:
35 39 explicit QHXYModelMapper(QObject *parent = 0);
40
41 QAbstractItemModel* model() const;
42 void setModel(QAbstractItemModel *model);
43
44 QXYSeries* series() const;
45 void setSeries(QXYSeries *series);
36 46
37 47 int xRow() const;
38 48 void setXRow(int xRow);
@@ -40,9 +50,19 public:
40 50 int yRow() const;
41 51 void setYRow(int yRow);
42 52
53 int firstColumn() const;
54 void setFirstColumn(int firstColumn);
55
56 int columnCount() const;
57 void setColumnCount(int columnCount);
58
43 59 Q_SIGNALS:
60 void seriesReplaced();
61 void modelReplaced();
44 62 void xRowChanged();
45 63 void yRowChanged();
64 void firstColumnChanged();
65 void columnCountChanged();
46 66 };
47 67
48 68 QTCOMMERCIALCHART_END_NAMESPACE
@@ -24,7 +24,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE
24 24
25 25 /*!
26 26 \class QVXYModelMapper
27 \brief part of QtCommercial chart API.
28 27 \mainclass
29 28
30 29 Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
@@ -34,6 +33,19 QTCOMMERCIALCHART_BEGIN_NAMESPACE
34 33 */
35 34
36 35 /*!
36 \property QVXYModelMapper::series
37 \brief Defines the QXYSeries object that is used by the mapper.
38
39 All the data in the series is discarded when it is set to the mapper.
40 When new series is specified the old series is disconnected (it preserves its data)
41 */
42
43 /*!
44 \property QVXYModelMapper::model
45 \brief Defines the model that is used by the mapper.
46 */
47
48 /*!
37 49 \property QVXYModelMapper::xColumn
38 50 \brief Defines which column of the model is kept in sync with the x values of QXYSeries
39 51
@@ -48,6 +60,40 QTCOMMERCIALCHART_BEGIN_NAMESPACE
48 60 */
49 61
50 62 /*!
63 \property QVXYModelMapper::firstRow
64 \brief Defines which row of the model contains the data for the first point of the series.
65 Minimal and default value is: 0
66 */
67 /*!
68 \qmlproperty int QVXYModelMapper::firstRow
69 Defines which row of the model contains the data for the first point of the series.
70 The default value is 0.
71 */
72
73 /*!
74 \property QVXYModelMapper::rowCount
75 \brief Defines the number of rows of the model that are mapped as the data for series
76 Minimal and default value is: -1 (count limited by the number of rows in the model)
77 */
78 /*!
79 \qmlproperty int QVXYModelMapper::columnCount
80 Defines the number of rows of the model that are mapped as the data for series. The default value is
81 -1 (count limited by the number of rows in the model)
82 */
83
84 /*!
85 \fn void QVXYModelMapper::seriesReplaced()
86
87 Emitted when the series to which mapper is connected to has changed.
88 */
89
90 /*!
91 \fn void QVXYModelMapper::modelReplaced()
92
93 Emitted when the model to which mapper is connected to has changed.
94 */
95
96 /*!
51 97 \fn void QVXYModelMapper::xColumnChanged()
52 98
53 99 Emitted when the xColumn has changed.
@@ -60,6 +106,16 QTCOMMERCIALCHART_BEGIN_NAMESPACE
60 106 */
61 107
62 108 /*!
109 \fn void QVXYModelMapper::firstRowChanged()
110 Emitted when the firstRow has changed.
111 */
112
113 /*!
114 \fn void QVXYModelMapper::rowCountChanged()
115 Emitted when the rowCount has changed.
116 */
117
118 /*!
63 119 Constructs a mapper object which is a child of \a parent.
64 120 */
65 121 QVXYModelMapper::QVXYModelMapper(QObject *parent) :
@@ -68,6 +124,32 QVXYModelMapper::QVXYModelMapper(QObject *parent) :
68 124 QXYModelMapper::setOrientation(Qt::Vertical);
69 125 }
70 126
127 QAbstractItemModel* QVXYModelMapper::model() const
128 {
129 return QXYModelMapper::model();
130 }
131
132 void QVXYModelMapper::setModel(QAbstractItemModel *model)
133 {
134 if (model != QXYModelMapper::model()) {
135 QXYModelMapper::setModel(model);
136 emit modelReplaced();
137 }
138 }
139
140 QXYSeries* QVXYModelMapper::series() const
141 {
142 return QXYModelMapper::series();
143 }
144
145 void QVXYModelMapper::setSeries(QXYSeries *series)
146 {
147 if (series != QXYModelMapper::series()) {
148 QXYModelMapper::setSeries(series);
149 emit seriesReplaced();
150 }
151 }
152
71 153 int QVXYModelMapper::xColumn() const
72 154 {
73 155 return QXYModelMapper::xSection();
@@ -94,6 +176,32 void QVXYModelMapper::setYColumn(int yColumn)
94 176 }
95 177 }
96 178
179 int QVXYModelMapper::firstRow() const
180 {
181 return first();
182 }
183
184 void QVXYModelMapper::setFirstRow(int firstRow)
185 {
186 if (firstRow != first()) {
187 setFirst(firstRow);
188 emit firstRowChanged();
189 }
190 }
191
192 int QVXYModelMapper::rowCount() const
193 {
194 return count();
195 }
196
197 void QVXYModelMapper::setRowCount(int rowCount)
198 {
199 if (rowCount != count()) {
200 setCount(rowCount);
201 emit firstRowChanged();
202 }
203 }
204
97 205 #include "moc_qvxymodelmapper.cpp"
98 206
99 207 QTCOMMERCIALCHART_END_NAMESPACE
@@ -28,11 +28,21 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 28 class QTCOMMERCIALCHART_EXPORT QVXYModelMapper : public QXYModelMapper
29 29 {
30 30 Q_OBJECT
31 Q_PROPERTY(QXYSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
32 Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
31 33 Q_PROPERTY(int xColumn READ xColumn WRITE setXColumn NOTIFY xColumnChanged)
32 34 Q_PROPERTY(int yColumn READ yColumn WRITE setYColumn NOTIFY yColumnChanged)
35 Q_PROPERTY(int firstRow READ firstRow WRITE setFirstRow NOTIFY firstRowChanged)
36 Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged)
33 37
34 38 public:
35 39 explicit QVXYModelMapper(QObject *parent = 0);
40
41 QAbstractItemModel* model() const;
42 void setModel(QAbstractItemModel *model);
43
44 QXYSeries* series() const;
45 void setSeries(QXYSeries *series);
36 46
37 47 int xColumn() const;
38 48 void setXColumn(int xColumn);
@@ -40,9 +50,19 public:
40 50 int yColumn() const;
41 51 void setYColumn(int yColumn);
42 52
53 int firstRow() const;
54 void setFirstRow(int firstRow);
55
56 int rowCount() const;
57 void setRowCount(int rowCount);
58
43 59 Q_SIGNALS:
60 void seriesReplaced();
61 void modelReplaced();
44 62 void xColumnChanged();
45 63 void yColumnChanged();
64 void firstRowChanged();
65 void rowCountChanged();
46 66 };
47 67
48 68 QTCOMMERCIALCHART_END_NAMESPACE
@@ -26,68 +26,6
26 26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27 27
28 28 /*!
29 \class QXYModelMapper
30 \brief part of QtCommercial chart API.
31 \mainclass
32
33 Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
34 The instance of this class cannot be created directly. QHXYModelMapper of QVXYModelMapper should be used instead. This class is used to create a connection between QXYSeries and QAbstractItemModel derived model object.
35 It is possible to use both QAbstractItemModel and QXYSeries model API. QXYModelMapper makes sure that QXYSeries and the model are kept in sync.
36 NOTE: used model has to support adding/removing rows/columns and modifying the data of the cells.
37 */
38
39 /*!
40 \property QXYModelMapper::series
41 \brief Defines the QPieSeries object that is used by the mapper.
42
43 All the data in the series is discarded when it is set to the mapper.
44 When new series is specified the old series is disconnected (it preserves its data)
45 */
46
47 /*!
48 \property QXYModelMapper::model
49 \brief Defines the model that is used by the mapper.
50 */
51
52 /*!
53 \property QXYModelMapper::first
54 \brief Defines which item of the model's row/column should be mapped as the first x/y pair
55
56 Minimal and default value is: 0
57 */
58
59 /*!
60 \property QXYModelMapper::count
61 \brief Defines the number of rows/columns of the model that are mapped as the data for QXYSeries
62
63 Minimal and default value is: -1 (count limited by the number of rows/columns in the model)
64 */
65
66 /*!
67 \fn void QXYModelMapper::seriesReplaced()
68
69 Emitted when the series to which mapper is connected to has changed.
70 */
71
72 /*!
73 \fn void QXYModelMapper::modelReplaced()
74
75 Emitted when the model to which mapper is connected to has changed.
76 */
77
78 /*!
79 \fn void QXYModelMapper::firstChanged()
80
81 Emitted when the value for the first has changed.
82 */
83
84 /*!
85 \fn void QXYModelMapper::countChanged()
86
87 Emitted when the value for the count has changed.
88 */
89
90 /*!
91 29 Constructs a mapper object which is a child of \a parent.
92 30 */
93 31 QXYModelMapper::QXYModelMapper(QObject *parent):
@@ -96,12 +34,18 QXYModelMapper::QXYModelMapper(QObject *parent):
96 34 {
97 35 }
98 36
37 /*!
38 \internal
39 */
99 40 QAbstractItemModel* QXYModelMapper::model() const
100 41 {
101 42 Q_D(const QXYModelMapper);
102 43 return d->m_model;
103 44 }
104 45
46 /*!
47 \internal
48 */
105 49 void QXYModelMapper::setModel(QAbstractItemModel *model)
106 50 {
107 51 if (model == 0)
@@ -120,16 +64,20 void QXYModelMapper::setModel(QAbstractItemModel *model)
120 64 connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
121 65 connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int)));
122 66 connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
123
124 emit modelReplaced();
125 67 }
126 68
69 /*!
70 \internal
71 */
127 72 QXYSeries* QXYModelMapper::series() const
128 73 {
129 74 Q_D(const QXYModelMapper);
130 75 return d->m_series;
131 76 }
132 77
78 /*!
79 \internal
80 */
133 81 void QXYModelMapper::setSeries(QXYSeries *series)
134 82 {
135 83 Q_D(QXYModelMapper);
@@ -146,42 +94,44 void QXYModelMapper::setSeries(QXYSeries *series)
146 94 connect(d->m_series, SIGNAL(pointAdded(int)), d, SLOT(handlePointAdded(int)));
147 95 connect(d->m_series, SIGNAL(pointRemoved(int)), d, SLOT(handlePointRemoved(int)));
148 96 connect(d->m_series, SIGNAL(pointReplaced(int)), d, SLOT(handlePointReplaced(int)));
149
150 emit seriesReplaced();
151 97 }
152 98
99 /*!
100 \internal
101 */
153 102 int QXYModelMapper::first() const
154 103 {
155 104 Q_D(const QXYModelMapper);
156 105 return d->m_first;
157 106 }
158 107
108 /*!
109 \internal
110 */
159 111 void QXYModelMapper::setFirst(int first)
160 112 {
161 113 Q_D(QXYModelMapper);
162 if (first != d->m_first) {
163 d->m_first = qMax(first, 0);
164 d->initializeXYFromModel();
165
166 emit firstChanged();
167 }
114 d->m_first = qMax(first, 0);
115 d->initializeXYFromModel();
168 116 }
169 117
118 /*!
119 \internal
120 */
170 121 int QXYModelMapper::count() const
171 122 {
172 123 Q_D(const QXYModelMapper);
173 124 return d->m_count;
174 125 }
175 126
127 /*!
128 \internal
129 */
176 130 void QXYModelMapper::setCount(int count)
177 131 {
178 132 Q_D(QXYModelMapper);
179 if (count != d->m_count) {
180 d->m_count = qMax(count, -1);
181 d->initializeXYFromModel();
182
183 emit countChanged();
184 }
133 d->m_count = qMax(count, -1);
134 d->initializeXYFromModel();
185 135 }
186 136
187 137 /*!
@@ -247,21 +197,6 void QXYModelMapper::setYSection(int ySection)
247 197 d->initializeXYFromModel();
248 198 }
249 199
250 /*!
251 Resets the QXYModelMapper to the default state.
252 first: 0; count: -1; xSection: -1; ySection: -1;
253 */
254 void QXYModelMapper::reset()
255 {
256 Q_D(QXYModelMapper);
257 d->m_first = 0;
258 d->m_count = -1;
259 d->m_orientation = Qt::Vertical;
260 d->m_xSection = -1;
261 d->m_ySection = -1;
262 d->initializeXYFromModel();
263 }
264
265 200 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
266 201
267 202 QXYModelMapperPrivate::QXYModelMapperPrivate(QXYModelMapper *q) :
@@ -34,16 +34,10 class QXYSeries;
34 34 class QTCOMMERCIALCHART_EXPORT QXYModelMapper : public QObject
35 35 {
36 36 Q_OBJECT
37 Q_PROPERTY(QXYSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
38 Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
39 Q_PROPERTY(int first READ first WRITE setFirst NOTIFY firstChanged)
40 Q_PROPERTY(int count READ count WRITE setCount NOTIFY countChanged)
41 Q_ENUMS(Qt::Orientation)
42 37
43 38 protected:
44 39 explicit QXYModelMapper(QObject *parent = 0);
45 40
46 public:
47 41 QAbstractItemModel* model() const;
48 42 void setModel(QAbstractItemModel *model);
49 43
@@ -56,9 +50,6 public:
56 50 int count() const;
57 51 void setCount(int count);
58 52
59 void reset();
60
61 protected:
62 53 Qt::Orientation orientation() const;
63 54 void setOrientation(Qt::Orientation orientation);
64 55
@@ -68,12 +59,6 protected:
68 59 int ySection() const;
69 60 void setYSection(int ySection);
70 61
71 Q_SIGNALS:
72 void seriesReplaced();
73 void modelReplaced();
74 void firstChanged();
75 void countChanged();
76
77 62 protected:
78 63 QXYModelMapperPrivate * const d_ptr;
79 64 Q_DECLARE_PRIVATE(QXYModelMapper)
@@ -218,8 +218,8 void tst_qxymodelmapper::verticalMapperCustomMapping()
218 218 mapper->setYColumn(1);
219 219 mapper->setModel(m_model);
220 220 mapper->setSeries(m_series);
221 mapper->setFirst(first);
222 mapper->setCount(countLimit);
221 mapper->setFirstRow(first);
222 mapper->setRowCount(countLimit);
223 223
224 224 QCOMPARE(m_series->count(), expectedCount);
225 225
@@ -295,8 +295,8 void tst_qxymodelmapper::horizontalMapperCustomMapping()
295 295 mapper->setYRow(1);
296 296 mapper->setModel(m_model);
297 297 mapper->setSeries(m_series);
298 mapper->setFirst(first);
299 mapper->setCount(countLimit);
298 mapper->setFirstColumn(first);
299 mapper->setColumnCount(countLimit);
300 300
301 301 QCOMPARE(m_series->count(), expectedCount);
302 302
@@ -315,15 +315,15 void tst_qxymodelmapper::seriesUpdated()
315 315 // setup the mapper
316 316 createVerticalMapper();
317 317 QCOMPARE(m_series->count(), m_modelRowCount);
318 QCOMPARE(m_vMapper->count(), -1);
318 QCOMPARE(m_vMapper->rowCount(), -1);
319 319
320 320 m_series->append(QPointF(100, 100));
321 321 QCOMPARE(m_series->count(), m_modelRowCount + 1);
322 QCOMPARE(m_vMapper->count(), -1); // the value should not change as it indicates 'all' items there are in the model
322 QCOMPARE(m_vMapper->rowCount(), -1); // the value should not change as it indicates 'all' items there are in the model
323 323
324 324 m_series->remove(m_series->points().last());
325 325 QCOMPARE(m_series->count(), m_modelRowCount);
326 QCOMPARE(m_vMapper->count(), -1); // the value should not change as it indicates 'all' items there are in the model
326 QCOMPARE(m_vMapper->rowCount(), -1); // the value should not change as it indicates 'all' items there are in the model
327 327
328 328 m_series->replace(m_series->points().first(), QPointF(25.0, 75.0));
329 329 QCOMPARE(m_model->data(m_model->index(0, 0)).toReal(), 25.0);
@@ -342,23 +342,23 void tst_qxymodelmapper::verticalModelInsertRows()
342 342 QCOMPARE(m_series->count(), m_modelRowCount + insertCount);
343 343
344 344 int first = 3;
345 m_vMapper->setFirst(3);
345 m_vMapper->setFirstRow(3);
346 346 QCOMPARE(m_series->count(), m_modelRowCount + insertCount - first);
347 347
348 348 m_model->insertRows(3, insertCount);
349 349 QCOMPARE(m_series->count(), m_modelRowCount + 2 * insertCount - first);
350 350
351 351 int countLimit = 6;
352 m_vMapper->setCount(countLimit);
352 m_vMapper->setRowCount(countLimit);
353 353 QCOMPARE(m_series->count(), qMin(countLimit, m_modelRowCount + 2 * insertCount - first));
354 354
355 355 m_model->insertRows(3, insertCount);
356 356 QCOMPARE(m_series->count(), qMin(countLimit, m_modelRowCount + 3 * insertCount - first));
357 357
358 m_vMapper->setFirst(0);
358 m_vMapper->setFirstRow(0);
359 359 QCOMPARE(m_series->count(), qMin(countLimit, m_modelRowCount + 3 * insertCount));
360 360
361 m_vMapper->setCount(-1);
361 m_vMapper->setRowCount(-1);
362 362 QCOMPARE(m_series->count(), m_modelRowCount + 3 * insertCount);
363 363 }
364 364
@@ -374,23 +374,23 void tst_qxymodelmapper::verticalModelRemoveRows()
374 374 QCOMPARE(m_series->count(), m_modelRowCount - removeCount);
375 375
376 376 int first = 1;
377 m_vMapper->setFirst(first);
377 m_vMapper->setFirstRow(first);
378 378 QCOMPARE(m_series->count(), m_modelRowCount - removeCount - first);
379 379
380 380 m_model->removeRows(1, removeCount);
381 381 QCOMPARE(m_series->count(), m_modelRowCount - 2 * removeCount - first);
382 382
383 383 int countLimit = 3;
384 m_vMapper->setCount(countLimit);
384 m_vMapper->setRowCount(countLimit);
385 385 QCOMPARE(m_series->count(), qMin(countLimit, m_modelRowCount - 2 * removeCount - first));
386 386
387 387 m_model->removeRows(1, removeCount);
388 388 QCOMPARE(m_series->count(), qMin(countLimit, m_modelRowCount - 3 * removeCount - first));
389 389
390 m_vMapper->setFirst(0);
390 m_vMapper->setFirstRow(0);
391 391 QCOMPARE(m_series->count(), qMin(countLimit, m_modelRowCount - 3 * removeCount));
392 392
393 m_vMapper->setCount(-1);
393 m_vMapper->setRowCount(-1);
394 394 QCOMPARE(m_series->count(), m_modelRowCount - 3 * removeCount);
395 395 }
396 396
@@ -462,23 +462,23 void tst_qxymodelmapper::horizontalModelInsertColumns()
462 462 QCOMPARE(m_series->count(), m_modelColumnCount + insertCount);
463 463
464 464 int first = 3;
465 m_hMapper->setFirst(3);
465 m_hMapper->setFirstColumn(3);
466 466 QCOMPARE(m_series->count(), m_modelColumnCount + insertCount - first);
467 467
468 468 m_model->insertColumns(3, insertCount);
469 469 QCOMPARE(m_series->count(), m_modelColumnCount + 2 * insertCount - first);
470 470
471 471 int countLimit = 6;
472 m_hMapper->setCount(countLimit);
472 m_hMapper->setColumnCount(countLimit);
473 473 QCOMPARE(m_series->count(), qMin(countLimit, m_modelColumnCount + 2 * insertCount - first));
474 474
475 475 m_model->insertColumns(3, insertCount);
476 476 QCOMPARE(m_series->count(), qMin(countLimit, m_modelColumnCount + 3 * insertCount - first));
477 477
478 m_hMapper->setFirst(0);
478 m_hMapper->setFirstColumn(0);
479 479 QCOMPARE(m_series->count(), qMin(countLimit, m_modelColumnCount + 3 * insertCount));
480 480
481 m_hMapper->setCount(-1);
481 m_hMapper->setColumnCount(-1);
482 482 QCOMPARE(m_series->count(), m_modelColumnCount + 3 * insertCount);
483 483 }
484 484
@@ -494,23 +494,23 void tst_qxymodelmapper::horizontalModelRemoveColumns()
494 494 QCOMPARE(m_series->count(), m_modelColumnCount - removeCount);
495 495
496 496 int first = 1;
497 m_hMapper->setFirst(first);
497 m_hMapper->setFirstColumn(first);
498 498 QCOMPARE(m_series->count(), m_modelColumnCount - removeCount - first);
499 499
500 500 m_model->removeColumns(1, removeCount);
501 501 QCOMPARE(m_series->count(), m_modelColumnCount - 2 * removeCount - first);
502 502
503 503 int countLimit = 3;
504 m_hMapper->setCount(countLimit);
504 m_hMapper->setColumnCount(countLimit);
505 505 QCOMPARE(m_series->count(), qMin(countLimit, m_modelColumnCount - 2 * removeCount - first));
506 506
507 507 m_model->removeColumns(1, removeCount);
508 508 QCOMPARE(m_series->count(), qMin(countLimit, m_modelColumnCount - 3 * removeCount - first));
509 509
510 m_hMapper->setFirst(0);
510 m_hMapper->setFirstColumn(0);
511 511 QCOMPARE(m_series->count(), qMin(countLimit, m_modelColumnCount - 3 * removeCount));
512 512
513 m_hMapper->setCount(-1);
513 m_hMapper->setColumnCount(-1);
514 514 QCOMPARE(m_series->count(), m_modelColumnCount - 3 * removeCount);
515 515 }
516 516
General Comments 0
You need to be logged in to leave comments. Login now