##// END OF EJS Templates
BarModel mapper properties first, count moved to Vertical and Horizontal mappers with more descriptive names
Marek Rosa -
r1495:11cee47053ee
parent child
Show More
@@ -65,8 +65,8 TableWidget::TableWidget(QWidget *parent)
65 65 QVBarModelMapper *mapper = new QVBarModelMapper(this);
66 66 mapper->setFirstBarSetColumn(1);
67 67 mapper->setLastBarSetColumn(4);
68 mapper->setFirst(first);
69 mapper->setCount(count);
68 mapper->setFirstRow(first);
69 mapper->setRowCount(count);
70 70 mapper->setSeries(series);
71 71 mapper->setModel(model);
72 72 chart->addSeries(series);
@@ -71,28 +71,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE
71 71 */
72 72
73 73 /*!
74 \property QBarModelMapper::first
75 \brief Defines which item of the model's row/column should be mapped as the value of the first QBarSet in the series.
76 Minimal and default value is: 0
77 */
78 /*!
79 \qmlproperty int BarModelMapper::first
80 Defines which item of the model's row/column should be mapped as the value of the first QBarSet in the series.
81 The default value is 0.
82 */
83
84 /*!
85 \property QBarModelMapper::count
86 \brief Defines the number of rows/columns of the model that are mapped as the data for QBarSeries
87 Minimal and default value is: -1 (count limited by the number of rows/columns in the model)
88 */
89 /*!
90 \qmlproperty int BarModelMapper::count
91 Defines the number of rows/columns of the model that are mapped as the data for QBarSeries. The default value is
92 -1 (count limited by the number of rows/columns in the model)
93 */
94
95 /*!
96 74 \fn void QBarModelMapper::seriesReplaced()
97 75 Emitted when the series to which mapper is connected to has changed.
98 76 */
@@ -103,16 +81,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE
103 81 */
104 82
105 83 /*!
106 \fn void QBarModelMapper::firstChanged()
107 Emitted when the value for the first has changed.
108 */
109
110 /*!
111 \fn void QBarModelMapper::countChanged()
112 Emitted when the value for the count has changed.
113 */
114
115 /*!
116 84 Constructs a mapper object which is a child of \a parent.
117 85 */
118 86 QBarModelMapper::QBarModelMapper(QObject *parent) :
@@ -175,38 +143,46 void QBarModelMapper::setSeries(QBarSeries *series)
175 143 emit seriesReplaced();
176 144 }
177 145
146 /*!
147 Returns which row/column of the model contains the first values of the QBarSets in the series.
148 The default value is 0.
149 */
178 150 int QBarModelMapper::first() const
179 151 {
180 152 Q_D(const QBarModelMapper);
181 153 return d->m_first;
182 154 }
183 155
156 /*!
157 Sets which row of the model contains the \a first values of the QBarSets in the series.
158 The default value is 0.
159 */
184 160 void QBarModelMapper::setFirst(int first)
185 161 {
186 162 Q_D(QBarModelMapper);
187 if (first != d->m_first) {
188 d->m_first = qMax(first, 0);
189 d->initializeBarFromModel();
190
191 emit firstChanged();
192 }
163 d->m_first = qMax(first, 0);
164 d->initializeBarFromModel();
193 165 }
194 166
167 /*!
168 Returns the number of rows/columns of the model that are mapped as the data for QBarSeries
169 Minimal and default value is: -1 (count limited by the number of rows/columns in the model)
170 */
195 171 int QBarModelMapper::count() const
196 172 {
197 173 Q_D(const QBarModelMapper);
198 174 return d->m_count;
199 175 }
200 176
177 /*!
178 Sets the \a count of rows/columns of the model that are mapped as the data for QBarSeries
179 Minimal and default value is: -1 (count limited by the number of rows/columns in the model)
180 */
201 181 void QBarModelMapper::setCount(int count)
202 182 {
203 183 Q_D(QBarModelMapper);
204 if (count != d->m_count) {
205 d->m_count = qMax(count, -1);
206 d->initializeBarFromModel();
207
208 emit countChanged();
209 }
184 d->m_count = qMax(count, -1);
185 d->initializeBarFromModel();
210 186 }
211 187
212 188 /*!
@@ -37,8 +37,6 class QTCOMMERCIALCHART_EXPORT QBarModelMapper : public QObject
37 37 Q_OBJECT
38 38 Q_PROPERTY(QBarSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
39 39 Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
40 Q_PROPERTY(int first READ first WRITE setFirst NOTIFY firstChanged)
41 Q_PROPERTY(int count READ count WRITE setCount NOTIFY countChanged)
42 40 Q_ENUMS(Qt::Orientation)
43 41
44 42 protected:
@@ -51,15 +49,15 public:
51 49 QBarSeries* series() const;
52 50 void setSeries(QBarSeries *series);
53 51
52 void reset();
53
54 protected:
54 55 int first() const;
55 56 void setFirst(int first);
56 57
57 58 int count() const;
58 59 void setCount(int count);
59 60
60 void reset();
61
62 protected:
63 61 int firstBarSetSection() const;
64 62 void setFirstBarSetSection(int firstBarSetSection);
65 63
@@ -72,8 +70,6 protected:
72 70 Q_SIGNALS:
73 71 void seriesReplaced();
74 72 void modelReplaced();
75 void firstChanged();
76 void countChanged();
77 73
78 74 protected:
79 75 QBarModelMapperPrivate * const d_ptr;
@@ -69,6 +69,28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
69 69 */
70 70
71 71 /*!
72 \property QHBarModelMapper::firstColumn
73 \brief Defines which column of the model contains the first values of the QBarSets in the series.
74 Minimal and default value is: 0
75 */
76 /*!
77 \qmlproperty int BarModelMapper::first
78 Defines which column of the model contains the first values of the QBarSets in the series.
79 The default value is 0.
80 */
81
82 /*!
83 \property QHBarModelMapper::columnCount
84 \brief Defines the number of rows of the model that are mapped as the data for QBarSeries
85 Minimal and default value is: -1 (count limited by the number of rows in the model)
86 */
87 /*!
88 \qmlproperty int BarModelMapper::count
89 Defines the number of rows of the model that are mapped as the data for QBarSeries. The default value is
90 -1 (count limited by the number of rows in the model)
91 */
92
93 /*!
72 94 \fn void QHBarModelMapper::firstBarSetRowChanged()
73 95
74 96 Emitted when the firstBarSetRow has changed.
@@ -81,6 +103,16 QTCOMMERCIALCHART_BEGIN_NAMESPACE
81 103 */
82 104
83 105 /*!
106 \fn void QHBarModelMapper::firstColumnChanged()
107 Emitted when the firstColumn has changed.
108 */
109
110 /*!
111 \fn void QHBarModelMapper::columnCountChanged()
112 Emitted when the columnCount has changed.
113 */
114
115 /*!
84 116 Constructs a mapper object which is a child of \a parent.
85 117 */
86 118 QHBarModelMapper::QHBarModelMapper(QObject *parent) :
@@ -97,7 +129,7 int QHBarModelMapper::firstBarSetRow() const
97 129 void QHBarModelMapper::setFirstBarSetRow(int firstBarSetRow)
98 130 {
99 131 if (firstBarSetRow != firstBarSetSection()) {
100 return QBarModelMapper::setFirstBarSetSection(firstBarSetRow);
132 QBarModelMapper::setFirstBarSetSection(firstBarSetRow);
101 133 emit firstBarSetRowChanged();
102 134 }
103 135 }
@@ -110,11 +142,37 int QHBarModelMapper::lastBarSetRow() const
110 142 void QHBarModelMapper::setLastBarSetRow(int lastBarSetRow)
111 143 {
112 144 if (lastBarSetRow != lastBarSetSection()) {
113 return QBarModelMapper::setLastBarSetSection(lastBarSetRow);
145 QBarModelMapper::setLastBarSetSection(lastBarSetRow);
114 146 emit lastBarSetRowChanged();
115 147 }
116 148 }
117 149
150 int QHBarModelMapper::firstColumn() const
151 {
152 return QBarModelMapper::first();
153 }
154
155 void QHBarModelMapper::setFirstColumn(int firstColumn)
156 {
157 if (firstColumn != first()) {
158 QBarModelMapper::setFirst(firstColumn);
159 emit firstColumnChanged();
160 }
161 }
162
163 int QHBarModelMapper::columnCount() const
164 {
165 return QBarModelMapper::count();
166 }
167
168 void QHBarModelMapper::setColumnCount(int columnCount)
169 {
170 if (columnCount != count()) {
171 QBarModelMapper::setCount(columnCount);
172 emit firstColumnChanged();
173 }
174 }
175
118 176 #include "moc_qhbarmodelmapper.cpp"
119 177
120 178 QTCOMMERCIALCHART_END_NAMESPACE
@@ -30,6 +30,8 class QTCOMMERCIALCHART_EXPORT QHBarModelMapper : public QBarModelMapper
30 30 Q_OBJECT
31 31 Q_PROPERTY(int firstBarSetRow READ firstBarSetRow WRITE setFirstBarSetRow NOTIFY firstBarSetRowChanged)
32 32 Q_PROPERTY(int lastBarSetRow READ lastBarSetRow WRITE setLastBarSetRow NOTIFY lastBarSetRowChanged)
33 Q_PROPERTY(int firstColumn READ firstColumn WRITE setFirstColumn NOTIFY firstColumnChanged)
34 Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount NOTIFY columnCountChanged)
33 35
34 36 public:
35 37 explicit QHBarModelMapper(QObject *parent = 0);
@@ -40,9 +42,17 public:
40 42 int lastBarSetRow() const;
41 43 void setLastBarSetRow(int lastBarSetRow);
42 44
45 int firstColumn() const;
46 void setFirstColumn(int firstColumn);
47
48 int columnCount() const;
49 void setColumnCount(int columnCount);
50
43 51 Q_SIGNALS:
44 52 void firstBarSetRowChanged();
45 53 void lastBarSetRowChanged();
54 void firstColumnChanged();
55 void columnCountChanged();
46 56 };
47 57
48 58 QTCOMMERCIALCHART_END_NAMESPACE
@@ -77,6 +77,28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
77 77 */
78 78
79 79 /*!
80 \property QVBarModelMapper::firstRow
81 \brief Defines which row of the model contains the first values of the QBarSets in the series.
82 Minimal and default value is: 0
83 */
84 /*!
85 \qmlproperty int BarModelMapper::first
86 Defines which row of the model contains the first values of the QBarSets in the series.
87 The default value is 0.
88 */
89
90 /*!
91 \property QVBarModelMapper::rowCount
92 \brief Defines the number of rows of the model that are mapped as the data for QBarSeries
93 Minimal and default value is: -1 (count limited by the number of rows in the model)
94 */
95 /*!
96 \qmlproperty int BarModelMapper::count
97 Defines the number of rows of the model that are mapped as the data for QBarSeries. The default value is
98 -1 (count limited by the number of rows in the model)
99 */
100
101 /*!
80 102 \fn void QVBarModelMapper::firstBarSetColumnChanged()
81 103 Emitted when the firstBarSetColumn has changed.
82 104 */
@@ -87,6 +109,16 QTCOMMERCIALCHART_BEGIN_NAMESPACE
87 109 */
88 110
89 111 /*!
112 \fn void QVBarModelMapper::firstRowChanged()
113 Emitted when the firstRow has changed.
114 */
115
116 /*!
117 \fn void QVBarModelMapper::rowCountChanged()
118 Emitted when the rowCount has changed.
119 */
120
121 /*!
90 122 Constructs a mapper object which is a child of \a parent.
91 123 */
92 124 QVBarModelMapper::QVBarModelMapper(QObject *parent) :
@@ -103,7 +135,7 int QVBarModelMapper::firstBarSetColumn() const
103 135 void QVBarModelMapper::setFirstBarSetColumn(int firstBarSetColumn)
104 136 {
105 137 if (firstBarSetColumn != firstBarSetSection()) {
106 return QBarModelMapper::setFirstBarSetSection(firstBarSetColumn);
138 QBarModelMapper::setFirstBarSetSection(firstBarSetColumn);
107 139 emit firstBarSetColumnChanged();
108 140 }
109 141 }
@@ -116,11 +148,37 int QVBarModelMapper::lastBarSetColumn() const
116 148 void QVBarModelMapper::setLastBarSetColumn(int lastBarSetColumn)
117 149 {
118 150 if (lastBarSetColumn != lastBarSetSection()) {
119 return QBarModelMapper::setLastBarSetSection(lastBarSetColumn);
151 QBarModelMapper::setLastBarSetSection(lastBarSetColumn);
120 152 emit lastBarSetColumnChanged();
121 153 }
122 154 }
123 155
156 int QVBarModelMapper::firstRow() const
157 {
158 return QBarModelMapper::first();
159 }
160
161 void QVBarModelMapper::setFirstRow(int firstRow)
162 {
163 if (firstRow != first()) {
164 QBarModelMapper::setFirst(firstRow);
165 emit firstRowChanged();
166 }
167 }
168
169 int QVBarModelMapper::rowCount() const
170 {
171 return QBarModelMapper::count();
172 }
173
174 void QVBarModelMapper::setRowCount(int rowCount)
175 {
176 if (rowCount != count()) {
177 QBarModelMapper::setCount(rowCount);
178 emit firstRowChanged();
179 }
180 }
181
124 182 #include "moc_qvbarmodelmapper.cpp"
125 183
126 184 QTCOMMERCIALCHART_END_NAMESPACE
@@ -30,6 +30,8 class QTCOMMERCIALCHART_EXPORT QVBarModelMapper : public QBarModelMapper
30 30 Q_OBJECT
31 31 Q_PROPERTY(int firstBarSetColumn READ firstBarSetColumn WRITE setFirstBarSetColumn NOTIFY firstBarSetColumnChanged)
32 32 Q_PROPERTY(int lastBarSetColumn READ lastBarSetColumn WRITE setLastBarSetColumn NOTIFY lastBarSetColumnChanged)
33 Q_PROPERTY(int firstRow READ firstRow WRITE setFirstRow NOTIFY firstRowChanged)
34 Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged)
33 35
34 36 public:
35 37 explicit QVBarModelMapper(QObject *parent = 0);
@@ -40,9 +42,17 public:
40 42 int lastBarSetColumn() const;
41 43 void setLastBarSetColumn(int lastBarSetColumn);
42 44
45 int firstRow() const;
46 void setFirstRow(int firstRow);
47
48 int rowCount() const;
49 void setRowCount(int rowCount);
50
43 51 Q_SIGNALS:
44 52 void firstBarSetColumnChanged();
45 53 void lastBarSetColumnChanged();
54 void firstRowChanged();
55 void rowCountChanged();
46 56 };
47 57
48 58 QTCOMMERCIALCHART_END_NAMESPACE
@@ -223,8 +223,8 void tst_qbarmodelmapper::verticalMapperCustomMapping()
223 223 mapper->setLastBarSetColumn(1);
224 224 mapper->setModel(m_model);
225 225 mapper->setSeries(m_series);
226 mapper->setFirst(first);
227 mapper->setCount(countLimit);
226 mapper->setFirstRow(first);
227 mapper->setRowCount(countLimit);
228 228 m_chart->addSeries(m_series);
229 229
230 230 QCOMPARE(m_series->count(), expectedBarSetCount);
@@ -313,8 +313,8 void tst_qbarmodelmapper::horizontalMapperCustomMapping()
313 313 mapper->setLastBarSetRow(1);
314 314 mapper->setModel(m_model);
315 315 mapper->setSeries(m_series);
316 mapper->setFirst(first);
317 mapper->setCount(countLimit);
316 mapper->setFirstColumn(first);
317 mapper->setColumnCount(countLimit);
318 318 m_chart->addSeries(m_series);
319 319
320 320 QCOMPARE(m_series->count(), expectedBarSetCount);
@@ -337,15 +337,15 void tst_qbarmodelmapper::seriesUpdated()
337 337 // setup the mapper
338 338 createVerticalMapper();
339 339 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount);
340 QCOMPARE(m_vMapper->count(), -1);
340 QCOMPARE(m_vMapper->rowCount(), -1);
341 341
342 342 m_series->barSets().first()->append(123);
343 343 QCOMPARE(m_model->rowCount(), m_modelRowCount + 1);
344 QCOMPARE(m_vMapper->count(), -1); // the value should not change as it indicates 'all' items there are in the model
344 QCOMPARE(m_vMapper->rowCount(), -1); // the value should not change as it indicates 'all' items there are in the model
345 345
346 346 m_series->barSets().last()->remove(0, m_modelRowCount);
347 347 QCOMPARE(m_model->rowCount(), 1);
348 QCOMPARE(m_vMapper->count(), -1); // the value should not change as it indicates 'all' items there are in the model
348 QCOMPARE(m_vMapper->rowCount(), -1); // the value should not change as it indicates 'all' items there are in the model
349 349
350 350 m_series->barSets().first()->replace(0, 444.0);
351 351 QCOMPARE(m_model->data(m_model->index(0, 0)).toReal(), 444.0);
@@ -389,7 +389,7 void tst_qbarmodelmapper::verticalModelInsertRows()
389 389 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + insertCount);
390 390
391 391 int first = 3;
392 m_vMapper->setFirst(3);
392 m_vMapper->setFirstRow(3);
393 393 QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
394 394 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + insertCount - first);
395 395
@@ -398,7 +398,7 void tst_qbarmodelmapper::verticalModelInsertRows()
398 398 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + 2 * insertCount - first);
399 399
400 400 int countLimit = 6;
401 m_vMapper->setCount(countLimit);
401 m_vMapper->setRowCount(countLimit);
402 402 QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
403 403 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount + 2 * insertCount - first));
404 404
@@ -406,11 +406,11 void tst_qbarmodelmapper::verticalModelInsertRows()
406 406 QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
407 407 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount + 3 * insertCount - first));
408 408
409 m_vMapper->setFirst(0);
409 m_vMapper->setFirstRow(0);
410 410 QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
411 411 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount + 3 * insertCount));
412 412
413 m_vMapper->setCount(-1);
413 m_vMapper->setRowCount(-1);
414 414 QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
415 415 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + 3 * insertCount);
416 416 }
@@ -429,7 +429,7 void tst_qbarmodelmapper::verticalModelRemoveRows()
429 429 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - removeCount);
430 430
431 431 int first = 1;
432 m_vMapper->setFirst(first);
432 m_vMapper->setFirstRow(first);
433 433 QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
434 434 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - removeCount - first);
435 435
@@ -438,7 +438,7 void tst_qbarmodelmapper::verticalModelRemoveRows()
438 438 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - 2 * removeCount - first);
439 439
440 440 int countLimit = 3;
441 m_vMapper->setCount(countLimit);
441 m_vMapper->setRowCount(countLimit);
442 442 QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
443 443 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount - 2 * removeCount - first));
444 444
@@ -446,11 +446,11 void tst_qbarmodelmapper::verticalModelRemoveRows()
446 446 QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
447 447 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount - 3 * removeCount - first));
448 448
449 m_vMapper->setFirst(0);
449 m_vMapper->setFirstRow(0);
450 450 QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
451 451 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount - 3 * removeCount));
452 452
453 m_vMapper->setCount(-1);
453 m_vMapper->setRowCount(-1);
454 454 QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1);
455 455 QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - 3 * removeCount);
456 456 }
@@ -533,7 +533,7 void tst_qbarmodelmapper::horizontalModelInsertColumns()
533 533 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + insertCount);
534 534
535 535 int first = 3;
536 m_hMapper->setFirst(3);
536 m_hMapper->setFirstColumn(3);
537 537 QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
538 538 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + insertCount - first);
539 539
@@ -542,7 +542,7 void tst_qbarmodelmapper::horizontalModelInsertColumns()
542 542 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + 2 * insertCount - first);
543 543
544 544 int countLimit = 6;
545 m_hMapper->setCount(countLimit);
545 m_hMapper->setColumnCount(countLimit);
546 546 QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
547 547 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount + 2 * insertCount - first));
548 548
@@ -550,11 +550,11 void tst_qbarmodelmapper::horizontalModelInsertColumns()
550 550 QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
551 551 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount + 3 * insertCount - first));
552 552
553 m_hMapper->setFirst(0);
553 m_hMapper->setFirstColumn(0);
554 554 QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
555 555 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount + 3 * insertCount));
556 556
557 m_hMapper->setCount(-1);
557 m_hMapper->setColumnCount(-1);
558 558 QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
559 559 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + 3 * insertCount);
560 560 }
@@ -573,7 +573,7 void tst_qbarmodelmapper::horizontalModelRemoveColumns()
573 573 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - removeCount);
574 574
575 575 int first = 1;
576 m_hMapper->setFirst(first);
576 m_hMapper->setFirstColumn(first);
577 577 QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
578 578 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - removeCount - first);
579 579
@@ -582,7 +582,7 void tst_qbarmodelmapper::horizontalModelRemoveColumns()
582 582 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - 2 * removeCount - first);
583 583
584 584 int countLimit = 3;
585 m_hMapper->setCount(countLimit);
585 m_hMapper->setColumnCount(countLimit);
586 586 QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
587 587 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount - 2 * removeCount - first));
588 588
@@ -590,11 +590,11 void tst_qbarmodelmapper::horizontalModelRemoveColumns()
590 590 QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
591 591 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount - 3 * removeCount - first));
592 592
593 m_hMapper->setFirst(0);
593 m_hMapper->setFirstColumn(0);
594 594 QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
595 595 QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount - 3 * removeCount));
596 596
597 m_hMapper->setCount(-1);
597 m_hMapper->setColumnCount(-1);
598 598 QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1);
599 599 QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - 3 * removeCount);
600 600 }
General Comments 0
You need to be logged in to leave comments. Login now