##// END OF EJS Templates
Added documentation for BarModelMapper classes
Marek Rosa -
r1348:da176c513ee6
parent child
Show More
@@ -1,432 +1,506
1 1 #include "qbarmodelmapper.h"
2 2 #include "qbarmodelmapper_p.h"
3 3 #include "qbarseries.h"
4 4 #include "qbarset.h"
5 5 #include "qchart.h"
6 6 #include "qaxis.h"
7 7 #include <QAbstractItemModel>
8 8
9 9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10 10
11 11 /*!
12 \property QBarModelMapper::series
13 \brief Defines the QPieSeries object that is used by the mapper.
14
15 All the data in the series in the series is discarded when it is set to the mapper.
16 When new series is specified the old series is disconnected (it preserves its data)
17 */
18
19 /*!
20 \property QBarModelMapper::model
21 \brief Defines the model that is used by the mapper.
22 */
23
24 /*!
25 \property QBarModelMapper::first
26 \brief Defines which item of the model's row/column should be mapped as the value of the first QBarSet in the series.
27
28 Minimal and default value is: 0
29 */
30
31 /*!
32 \property QBarModelMapper::count
33 \brief Defines the number of rows/columns of the model that are mapped as the data for QBarSeries
34
35 Minimal and default value is: -1 (count limited by the number of rows/columns in the model)
36 */
37
38 /*!
39 \class QBarModelMapper
40 \brief part of QtCommercial chart API.
41 \mainclass
42
43 The instance of this class cannot be created directly. QHBarModelMapper of QVBarModelMapper should be used instead. This class is used to create a connection between QBarSeries and QAbstractItemModel derived model object.
44 Curently it is NOT possible to use both QAbstractItemModel and QXYSeries model API.
45 When the series is set to the mapper the QBarSeries and QBarSet API that affect the data (append, setValue, remove) should not be used.
46 The model and the QBarSeries won't be kept in sync. Model API should be used to insert,remove,modify BarSets.
47 NOTE: used model has to support adding/removing rows/columns and modifying the data of the cells.
48 */
49
50 /*!
12 51 Constructs a mapper object which is a child of \a parent.
13 52 */
14 53 QBarModelMapper::QBarModelMapper(QObject *parent) :
15 54 QObject(parent),
16 55 d_ptr(new QBarModelMapperPrivate(this))
17 56 {
18 57 }
19 58
20 59 QAbstractItemModel* QBarModelMapper::model() const
21 60 {
22 61 Q_D(const QBarModelMapper);
23 62 return d->m_model;
24 63 }
25 64
26 65 void QBarModelMapper::setModel(QAbstractItemModel *model)
27 66 {
28 67 if (model == 0)
29 68 return;
30 69
31 70 Q_D(QBarModelMapper);
32 71 if (d->m_model) {
33 72 disconnect(d->m_model, 0, d, 0);
34 73 }
35 74
36 75 d->m_model = model;
37 76 d->initializeBarFromModel();
38 77 // connect signals from the model
39 78 connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex)));
40 79 connect(d->m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int)));
41 80 connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
42 81 connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int)));
43 82 connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
44 83 }
45 84
46 85 QBarSeries* QBarModelMapper::series() const
47 86 {
48 87 Q_D(const QBarModelMapper);
49 88 return d->m_series;
50 89 }
51 90
52 91 void QBarModelMapper::setSeries(QBarSeries *series)
53 92 {
54 93 Q_D(QBarModelMapper);
55 94 if (d->m_series) {
56 95 disconnect(d->m_series, 0, d, 0);
57 96 }
58 97
59 98 if (series == 0)
60 99 return;
61 100
62 101 d->m_series = series;
63 102 d->initializeBarFromModel();
64 103 // connect the signals from the series
65 104 // connect(d->m_series, SIGNAL(pointAdded(int)), d, SLOT(handlePointAdded(int)));
66 105 // connect(d->m_series, SIGNAL(pointRemoved(int)), d, SLOT(handlePointRemoved(int)));
67 106 // connect(d->m_series, SIGNAL(pointReplaced(int)), d, SLOT(handlePointReplaced(int)));
68 107 }
69 108
70 109 int QBarModelMapper::first() const
71 110 {
72 111 Q_D(const QBarModelMapper);
73 112 return d->m_first;
74 113 }
75 114
76 115 void QBarModelMapper::setFirst(int first)
77 116 {
78 117 Q_D(QBarModelMapper);
79 118 d->m_first = qMax(first, 0);
80 119 d->initializeBarFromModel();
81 120 }
82 121
83 122 int QBarModelMapper::count() const
84 123 {
85 124 Q_D(const QBarModelMapper);
86 125 return d->m_count;
87 126 }
88 127
89 128 void QBarModelMapper::setCount(int count)
90 129 {
91 130 Q_D(QBarModelMapper);
92 131 d->m_count = qMax(count, -1);
93 132 d->initializeBarFromModel();
94 133 }
95 134
135 /*!
136 Returns the orientation that is used when QBarModelMapper accesses the model.
137 This mean whether the consecutive values of the bar set are read from row (Qt::Horizontal)
138 or from columns (Qt::Vertical)
139 */
96 140 Qt::Orientation QBarModelMapper::orientation() const
97 141 {
98 142 Q_D(const QBarModelMapper);
99 143 return d->m_orientation;
100 144 }
101 145
146 /*!
147 Returns the \a orientation that is used when QBarModelMapper accesses the model.
148 This mean whether the consecutive values of the pie are read from row (Qt::Horizontal)
149 or from columns (Qt::Vertical)
150 */
102 151 void QBarModelMapper::setOrientation(Qt::Orientation orientation)
103 152 {
104 153 Q_D(QBarModelMapper);
105 154 d->m_orientation = orientation;
106 155 d->initializeBarFromModel();
107 156 }
108 157
158 /*!
159 Returns which section of the model is used as the data source for the first bar set
160 */
109 161 int QBarModelMapper::firstBarSetSection() const
110 162 {
111 163 Q_D(const QBarModelMapper);
112 164 return d->m_firstBarSetSection;
113 165 }
114 166
167 /*!
168 Sets the model section that is used as the data source for the first bar set
169 Parameter \a firstBarSetSection specifies the section of the model.
170 */
115 171 void QBarModelMapper::setFirstBarSetSection(int firstBarSetSection)
116 172 {
117 173 Q_D(QBarModelMapper);
118 174 d->m_firstBarSetSection = firstBarSetSection;
119 175 d->initializeBarFromModel();
120 176 }
121 177
178 /*!
179 Returns which section of the model is used as the data source for the last bar set
180 */
122 181 int QBarModelMapper::lastBarSetSection() const
123 182 {
124 183 Q_D(const QBarModelMapper);
125 184 return d->m_lastBarSetSection;
126 185 }
127 186
187 /*!
188 Sets the model section that is used as the data source for the last bar set
189 Parameter \a lastBarSetSection specifies the section of the model.
190 */
128 191 void QBarModelMapper::setLastBarSetSection(int lastBarSetSection)
129 192 {
130 193 Q_D(QBarModelMapper);
131 194 d->m_lastBarSetSection = lastBarSetSection;
132 195 d->initializeBarFromModel();
133 196 }
134 197
198 /*!
199 Returns which section of the model is used as the data source for the x axis categories.
200 */
135 201 int QBarModelMapper::categoriesSection() const
136 202 {
137 203 Q_D(const QBarModelMapper);
138 204 return d->m_categoriesSection;
139 205 }
140 206
207 /*!
208 Sets the model section that is used as the data source for the x axis categories.
209 Parameter \a categoriesSection specifies the section of the model.
210 */
141 211 void QBarModelMapper::setCategoriesSection(int categoriesSection)
142 212 {
143 213 Q_D(QBarModelMapper);
144 214 d->m_categoriesSection = categoriesSection;
145 215 d->initializeBarFromModel();
146 216 }
147 217
218 /*!
219 Resets the QBarModelMapper to the default state.
220 first: 0; count: -1; firstBarSetSection: -1; lastBarSetSection: -1; categoriesSection: -1
221 */
148 222 void QBarModelMapper::reset()
149 223 {
150 224 Q_D(QBarModelMapper);
151 225 d->m_first = 0;
152 226 d->m_count = -1;
153 227 d->m_firstBarSetSection = -1;
154 228 d->m_lastBarSetSection = -1;
155 229 d->m_categoriesSection = -1;
156 230 d->initializeBarFromModel();
157 231 }
158 232
159 233 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
160 234
161 235 QBarModelMapperPrivate::QBarModelMapperPrivate(QBarModelMapper *q) :
162 236 m_series(0),
163 237 m_model(0),
164 238 m_first(0),
165 239 m_count(-1),
166 240 m_orientation(Qt::Vertical),
167 241 m_firstBarSetSection(-1),
168 242 m_lastBarSetSection(-1),
169 243 m_categoriesSection(-1),
170 244 m_seriesSignalsBlock(false),
171 245 m_modelSignalsBlock(false),
172 246 q_ptr(q)
173 247 {
174 248 }
175 249
176 250 void QBarModelMapperPrivate::blockModelSignals(bool block)
177 251 {
178 252 m_modelSignalsBlock = block;
179 253 }
180 254
181 255 void QBarModelMapperPrivate::blockSeriesSignals(bool block)
182 256 {
183 257 m_seriesSignalsBlock = block;
184 258 }
185 259
186 260 QBarSet* QBarModelMapperPrivate::barSet(QModelIndex index)
187 261 {
188 262 if (!index.isValid())
189 263 return 0;
190 264
191 265 if (m_orientation == Qt::Vertical && index.column() >= m_firstBarSetSection && index.column() <= m_lastBarSetSection) {
192 266 if (index.row() >= m_first && (m_count == - 1 || index.row() < m_first + m_count)) {
193 267 // if (m_model->index(index.row(), m_valuesSection).isValid() && m_model->index(index.row(), m_labelsSection).isValid())
194 268 return m_series->barSets().at(index.column() - m_firstBarSetSection);
195 269 // else
196 270 // return 0;
197 271 }
198 272 } else if (m_orientation == Qt::Horizontal && index.row() >= m_firstBarSetSection && index.row() <= m_lastBarSetSection) {
199 273 if (index.column() >= m_first && (m_count == - 1 || index.column() < m_first + m_count))
200 274 return m_series->barSets().at(index.row() - m_firstBarSetSection);
201 275 }
202 276 return 0; // This part of model has not been mapped to any slice
203 277 }
204 278
205 279 QModelIndex QBarModelMapperPrivate::barModelIndex(int barSection, int posInBar)
206 280 {
207 281 if (m_count != -1 && posInBar >= m_count)
208 282 return QModelIndex(); // invalid
209 283
210 284 if (barSection < m_firstBarSetSection || barSection > m_lastBarSetSection)
211 285 return QModelIndex(); // invalid
212 286
213 287 if (m_orientation == Qt::Vertical)
214 288 return m_model->index(posInBar + m_first, barSection);
215 289 else
216 290 return m_model->index(barSection, posInBar + m_first);
217 291 }
218 292
219 293 QModelIndex QBarModelMapperPrivate::categoriesModelIndex(int posInCategories)
220 294 {
221 295 if (m_count != -1 && posInCategories >= m_count)
222 296 return QModelIndex(); // invalid
223 297
224 298 if (m_orientation == Qt::Vertical)
225 299 return m_model->index(posInCategories + m_first, m_categoriesSection);
226 300 else
227 301 return m_model->index(m_categoriesSection, posInCategories + m_first);
228 302 }
229 303
230 304 void QBarModelMapperPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
231 305 {
232 306 Q_UNUSED(topLeft)
233 307 Q_UNUSED(bottomRight)
234 308
235 309 if (m_model == 0 || m_series == 0)
236 310 return;
237 311
238 312 if (m_modelSignalsBlock)
239 313 return;
240 314
241 315 blockSeriesSignals();
242 316 QModelIndex index;
243 317 // QPointF oldPoint;
244 318 // QPointF newPoint;
245 319 for (int row = topLeft.row(); row <= bottomRight.row(); row++) {
246 320 for (int column = topLeft.column(); column <= bottomRight.column(); column++) {
247 321 index = topLeft.sibling(row, column);
248 322 QBarSet* bar = barSet(index);
249 323 if (bar) {
250 324 if (m_orientation == Qt::Vertical)
251 325 bar->replace(row - m_first, m_model->data(index).toReal());
252 326 else
253 327 bar->replace(column - m_first, m_model->data(index).toReal());
254 328 }
255 329 }
256 330 }
257 331 blockSeriesSignals(false);
258 332 }
259 333
260 334 void QBarModelMapperPrivate::modelRowsAdded(QModelIndex parent, int start, int end)
261 335 {
262 336 Q_UNUSED(parent);
263 337 Q_UNUSED(end)
264 338 if (m_modelSignalsBlock)
265 339 return;
266 340
267 341 blockSeriesSignals();
268 342 if (m_orientation == Qt::Vertical)
269 343 // insertData(start, end);
270 344 initializeBarFromModel();
271 345 else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection || start <= m_categoriesSection) // if the changes affect the map - reinitialize
272 346 initializeBarFromModel();
273 347 blockSeriesSignals(false);
274 348 }
275 349
276 350 void QBarModelMapperPrivate::modelRowsRemoved(QModelIndex parent, int start, int end)
277 351 {
278 352 Q_UNUSED(parent);
279 353 Q_UNUSED(end)
280 354 if (m_modelSignalsBlock)
281 355 return;
282 356
283 357 blockSeriesSignals();
284 358 if (m_orientation == Qt::Vertical)
285 359 // removeData(start, end);
286 360 initializeBarFromModel();
287 361 else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection || start <= m_categoriesSection) // if the changes affect the map - reinitialize
288 362 initializeBarFromModel();
289 363 blockSeriesSignals(false);
290 364 }
291 365
292 366 void QBarModelMapperPrivate::modelColumnsAdded(QModelIndex parent, int start, int end)
293 367 {
294 368 Q_UNUSED(parent);
295 369 Q_UNUSED(end)
296 370 if (m_modelSignalsBlock)
297 371 return;
298 372
299 373 blockSeriesSignals();
300 374 if (m_orientation == Qt::Horizontal)
301 375 // insertData(start, end);
302 376 initializeBarFromModel();
303 377 else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection || start <= m_categoriesSection) // if the changes affect the map - reinitialize
304 378 initializeBarFromModel();
305 379 blockSeriesSignals(false);
306 380 }
307 381
308 382 void QBarModelMapperPrivate::modelColumnsRemoved(QModelIndex parent, int start, int end)
309 383 {
310 384 Q_UNUSED(parent);
311 385 Q_UNUSED(end)
312 386 if (m_modelSignalsBlock)
313 387 return;
314 388
315 389 blockSeriesSignals();
316 390 if (m_orientation == Qt::Horizontal)
317 391 // removeData(start, end);
318 392 initializeBarFromModel();
319 393 else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection || start <= m_categoriesSection) // if the changes affect the map - reinitialize
320 394 initializeBarFromModel();
321 395 blockSeriesSignals(false);
322 396 }
323 397
324 398 void QBarModelMapperPrivate::insertData(int start, int end)
325 399 {
326 400 Q_UNUSED(end)
327 401 if (m_model == 0 || m_series == 0)
328 402 return;
329 403
330 404 if (m_count != -1 && start >= m_first + m_count) {
331 405 return;
332 406 } /*else {
333 407 int addedCount = end - start + 1;
334 408 if (m_count != -1 && addedCount > m_count)
335 409 addedCount = m_count;
336 410 int first = qMax(start, m_first);
337 411 int last = qMin(first + addedCount - 1, m_orientation == Qt::Vertical ? m_model->rowCount() - 1 : m_model->columnCount() - 1);
338 412 for (int k = 0; k < m_series->barSets().count(); k++) {
339 413 for (int i = first; i <= last; i++) {
340 414 QBar point;
341 415 point.setX(m_model->data(xModelIndex(i - m_first), Qt::DisplayRole).toDouble());
342 416 point.setY(m_model->data(yModelIndex(i - m_first), Qt::DisplayRole).toDouble());
343 417 m_series->insert(i - m_first, point);
344 418 }
345 419 >>>>>>> Stashed changes
346 420 }
347 421
348 422 // remove excess of slices (abouve m_count)
349 423 if (m_count != -1 && m_series->points().size() > m_count)
350 424 for (int i = m_series->points().size() - 1; i >= m_count; i--) {
351 425 m_series->remove(m_series->points().at(i));
352 426 }
353 427 }*/
354 428 }
355 429
356 430 void QBarModelMapperPrivate::removeData(int start, int end)
357 431 {
358 432 Q_UNUSED(end)
359 433 if (m_model == 0 || m_series == 0)
360 434 return;
361 435
362 436 // int removedCount = end - start + 1;
363 437 if (m_count != -1 && start >= m_first + m_count) {
364 438 return;
365 439 } /*else {
366 440 int toRemove = qMin(m_series->count(), removedCount); // first find how many items can actually be removed
367 441 int first = qMax(start, m_first); // get the index of the first item that will be removed.
368 442 int last = qMin(first + toRemove - 1, m_series->count() + m_first - 1); // get the index of the last item that will be removed.
369 443 for (int i = last; i >= first; i--) {
370 444 m_series->remove(m_series->points().at(i - m_first));
371 445 }
372 446
373 447 if (m_count != -1) {
374 448 int itemsAvailable; // check how many are available to be added
375 449 if (m_orientation == Qt::Vertical)
376 450 itemsAvailable = m_model->rowCount() - m_first - m_series->count();
377 451 else
378 452 itemsAvailable = m_model->columnCount() - m_first - m_series->count();
379 453 int toBeAdded = qMin(itemsAvailable, m_count - m_series->count()); // add not more items than there is space left to be filled.
380 454 int currentSize = m_series->count();
381 455 if (toBeAdded > 0)
382 456 for (int i = m_series->count(); i < currentSize + toBeAdded; i++) {
383 457 QPointF point;
384 458 point.setX(m_model->data(xModelIndex(i), Qt::DisplayRole).toDouble());
385 459 point.setY(m_model->data(yModelIndex(i), Qt::DisplayRole).toDouble());
386 460 m_series->insert(i, point);
387 461 }
388 462 }
389 463 }*/
390 464 }
391 465
392 466 void QBarModelMapperPrivate::initializeBarFromModel()
393 467 {
394 468 if (m_model == 0 || m_series == 0)
395 469 return;
396 470
397 471 blockSeriesSignals();
398 472 // clear current content
399 473 m_series->clear();
400 474
401 475 // create the initial bar sets
402 476 for (int i = m_firstBarSetSection; i <= m_lastBarSetSection; i++) {
403 477 int posInBar = 0;
404 478 QModelIndex barIndex = barModelIndex(i, posInBar);
405 479 QBarSet *barSet = new QBarSet(m_model->headerData(i, Qt::Horizontal).toString());
406 480 // QModelIndex yIndex = yModelIndex(pointPos);
407 481 while (barIndex.isValid()) {
408 482 barSet->append(m_model->data(barIndex, Qt::DisplayRole).toDouble());
409 483 posInBar++;
410 484 barIndex = barModelIndex(i, posInBar);
411 485 }
412 486 m_series->append(barSet);
413 487 }
414 488
415 489 if (m_series->chart() && m_categoriesSection != -1) {
416 490 int posInCategories = 0;
417 491 QStringList categories;
418 492 QModelIndex categoriesIndex = categoriesModelIndex(posInCategories);
419 493 while (categoriesIndex.isValid()) {
420 494 categories.append(m_model->data(categoriesIndex, Qt::DisplayRole).toString());
421 495 posInCategories++;
422 496 categoriesIndex = categoriesModelIndex(posInCategories);
423 497 }
424 498 m_series->chart()->axisX()->categories()->insert(categories);
425 499 }
426 500 blockSeriesSignals(false);
427 501 }
428 502
429 503 #include "moc_qbarmodelmapper.cpp"
430 504 #include "moc_qbarmodelmapper_p.cpp"
431 505
432 506 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,65 +1,62
1 1 #ifndef QBARMODELMAPPER_H
2 2 #define QBARMODELMAPPER_H
3 3
4 4 #include "qchartglobal.h"
5 5 #include <QObject>
6 6
7 7 class QAbstractItemModel;
8 8
9 9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10 10
11 11 class QBarModelMapperPrivate;
12 12 class QBarSeries;
13 13 class QChart;
14 14
15 15 class QTCOMMERCIALCHART_EXPORT QBarModelMapper : public QObject
16 16 {
17 17 Q_OBJECT
18 18 Q_PROPERTY(QBarSeries *series READ series WRITE setSeries)
19 19 Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel)
20 20 Q_PROPERTY(int first READ first WRITE setFirst)
21 21 Q_PROPERTY(int count READ count WRITE setCount)
22 22 Q_ENUMS(Qt::Orientation)
23 23
24 24 protected:
25 25 explicit QBarModelMapper(QObject *parent = 0);
26 26
27 27 public:
28 28 QAbstractItemModel* model() const;
29 29 void setModel(QAbstractItemModel *model);
30 30
31 31 QBarSeries* series() const;
32 32 void setSeries(QBarSeries *series);
33 33
34 34 int first() const;
35 35 void setFirst(int first);
36 36
37 37 int count() const;
38 38 void setCount(int count);
39 39
40 40 void reset();
41 41
42 42 protected:
43 43 int firstBarSetSection() const;
44 44 void setFirstBarSetSection(int firstBarSetSection);
45 45
46 46 int lastBarSetSection() const;
47 47 void setLastBarSetSection(int lastBarSetSection);
48 48
49 49 int categoriesSection() const;
50 50 void setCategoriesSection(int categoriesSection);
51 51
52 52 Qt::Orientation orientation() const;
53 53 void setOrientation(Qt::Orientation orientation);
54 54
55 Q_SIGNALS:
56 void updated();
57
58 55 protected:
59 56 QBarModelMapperPrivate * const d_ptr;
60 57 Q_DECLARE_PRIVATE(QBarModelMapper)
61 58 };
62 59
63 60 QTCOMMERCIALCHART_END_NAMESPACE
64 61
65 62 #endif // QBARMODELMAPPER_H
@@ -1,54 +1,75
1 1 #include "qhbarmodelmapper.h"
2 2
3 3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4 4
5 5 /*!
6 6 \class QHBarModelMapper
7 7 \brief part of QtCommercial chart API.
8 8 \mainclass
9 9
10 10 Nothing here yet
11 11 */
12 12
13 13 /*!
14 \property QHBarModelMapper::firstBarSetRow
15 \brief Defines which column of the model is used as the data source for the first bar set
16
17 Default value is: -1 (invalid mapping)
18 */
19
20 /*!
21 \property QHBarModelMapper::lastBarSetRow
22 \brief Defines which column of the model is used as the data source for the last bar set
23
24 Default value is: -1 (invalid mapping)
25 */
26
27 /*!
28 \property QHBarModelMapper::categoriesRow
29 \brief Defines which row of the model is used as the data source for the x axis categories
30
31 Default value is: -1 (invalid mapping)
32 */
33
34 /*!
14 35 Constructs a mapper object which is a child of \a parent.
15 36 */
16 37 QHBarModelMapper::QHBarModelMapper(QObject *parent) :
17 38 QBarModelMapper(parent)
18 39 {
19 40 QBarModelMapper::setOrientation(Qt::Horizontal);
20 41 }
21 42
22 43 int QHBarModelMapper::firstBarSetRow() const
23 44 {
24 45 return QBarModelMapper::firstBarSetSection();
25 46 }
26 47
27 48 void QHBarModelMapper::setFirstBarSetRow(int firstBarSetRow)
28 49 {
29 50 return QBarModelMapper::setFirstBarSetSection(firstBarSetRow);
30 51 }
31 52
32 53 int QHBarModelMapper::lastBarSetRow() const
33 54 {
34 55 return QBarModelMapper::lastBarSetSection();
35 56 }
36 57
37 58 void QHBarModelMapper::setLastBarSetRow(int lastBarSetRow)
38 59 {
39 60 return QBarModelMapper::setLastBarSetSection(lastBarSetRow);
40 61 }
41 62
42 63 int QHBarModelMapper::categoriesRow() const
43 64 {
44 65 return QBarModelMapper::categoriesSection();
45 66 }
46 67
47 68 void QHBarModelMapper::setCategoriesRow(int categoriesRow)
48 69 {
49 70 return QBarModelMapper::setCategoriesSection(categoriesRow);
50 71 }
51 72
52 73 #include "moc_qhbarmodelmapper.cpp"
53 74
54 75 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,54 +1,75
1 1 #include "qvbarmodelmapper.h"
2 2
3 3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4 4
5 5 /*!
6 6 \class QVBarModelMapper
7 7 \brief part of QtCommercial chart API.
8 8 \mainclass
9 9
10 10 Nothing here yet
11 11 */
12 12
13 13 /*!
14 \property QVBarModelMapper::firstBarSetColumn
15 \brief Defines which column of the model is used as the data source for the first bar set
16
17 Default value is: -1 (invalid mapping)
18 */
19
20 /*!
21 \property QVBarModelMapper::lastBarSetColumn
22 \brief Defines which column of the model is used as the data source for the last bar set
23
24 Default value is: -1 (invalid mapping)
25 */
26
27 /*!
28 \property QVBarModelMapper::categoriesColumn
29 \brief Defines which column of the model is used as the data source for the x axis categories
30
31 Default value is: -1 (invalid mapping)
32 */
33
34 /*!
14 35 Constructs a mapper object which is a child of \a parent.
15 36 */
16 37 QVBarModelMapper::QVBarModelMapper(QObject *parent) :
17 38 QBarModelMapper(parent)
18 39 {
19 40 QBarModelMapper::setOrientation(Qt::Vertical);
20 41 }
21 42
22 43 int QVBarModelMapper::firstBarSetColumn() const
23 44 {
24 45 return QBarModelMapper::firstBarSetSection();
25 46 }
26 47
27 48 void QVBarModelMapper::setFirstBarSetColumn(int firstBarSetColumn)
28 49 {
29 50 return QBarModelMapper::setFirstBarSetSection(firstBarSetColumn);
30 51 }
31 52
32 53 int QVBarModelMapper::lastBarSetColumn() const
33 54 {
34 55 return QBarModelMapper::lastBarSetSection();
35 56 }
36 57
37 58 void QVBarModelMapper::setLastBarSetColumn(int lastBarSetColumn)
38 59 {
39 60 return QBarModelMapper::setLastBarSetSection(lastBarSetColumn);
40 61 }
41 62
42 63 int QVBarModelMapper::categoriesColumn() const
43 64 {
44 65 return QBarModelMapper::categoriesSection();
45 66 }
46 67
47 68 void QVBarModelMapper::setCategoriesColumn(int categoriesColumn)
48 69 {
49 70 return QBarModelMapper::setCategoriesSection(categoriesColumn);
50 71 }
51 72
52 73 #include "moc_qvbarmodelmapper.cpp"
53 74
54 75 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now