##// END OF EJS Templates
Removed commented out code and unnecessary lines from model mapper classes
Marek Rosa -
r1379:e28c452cfa1d
parent child
Show More
@@ -120,9 +120,7 void QBarModelMapper::setSeries(QBarSeries *series)
120 d->m_series = series;
120 d->m_series = series;
121 d->initializeBarFromModel();
121 d->initializeBarFromModel();
122 // connect the signals from the series
122 // connect the signals from the series
123 // connect(d->m_series, SIGNAL(pointAdded(int)), d, SLOT(handlePointAdded(int)));
123 // TODO: TO be implemented
124 // connect(d->m_series, SIGNAL(pointRemoved(int)), d, SLOT(handlePointRemoved(int)));
125 // connect(d->m_series, SIGNAL(pointReplaced(int)), d, SLOT(handlePointReplaced(int)));
126 }
124 }
127
125
128 int QBarModelMapper::first() const
126 int QBarModelMapper::first() const
@@ -382,69 +380,17 void QBarModelMapperPrivate::modelColumnsRemoved(QModelIndex parent, int start,
382 void QBarModelMapperPrivate::insertData(int start, int end)
380 void QBarModelMapperPrivate::insertData(int start, int end)
383 {
381 {
384 Q_UNUSED(end)
382 Q_UNUSED(end)
385 if (m_model == 0 || m_series == 0)
383 Q_UNUSED(start)
386 return;
384 Q_UNUSED(end)
387
385 // To be implemented
388 if (m_count != -1 && start >= m_first + m_count) {
389 return;
390 } /*else {
391 int addedCount = end - start + 1;
392 if (m_count != -1 && addedCount > m_count)
393 addedCount = m_count;
394 int first = qMax(start, m_first);
395 int last = qMin(first + addedCount - 1, m_orientation == Qt::Vertical ? m_model->rowCount() - 1 : m_model->columnCount() - 1);
396 for (int k = 0; k < m_series->barSets().count(); k++) {
397 for (int i = first; i <= last; i++) {
398 QBar point;
399 point.setX(m_model->data(xModelIndex(i - m_first), Qt::DisplayRole).toDouble());
400 point.setY(m_model->data(yModelIndex(i - m_first), Qt::DisplayRole).toDouble());
401 m_series->insert(i - m_first, point);
402 }
403 >>>>>>> Stashed changes
404 }
405
406 // remove excess of slices (abouve m_count)
407 if (m_count != -1 && m_series->points().size() > m_count)
408 for (int i = m_series->points().size() - 1; i >= m_count; i--) {
409 m_series->remove(m_series->points().at(i));
410 }
411 }*/
412 }
386 }
413
387
414 void QBarModelMapperPrivate::removeData(int start, int end)
388 void QBarModelMapperPrivate::removeData(int start, int end)
415 {
389 {
416 Q_UNUSED(end)
390 Q_UNUSED(end)
417 if (m_model == 0 || m_series == 0)
391 Q_UNUSED(start)
418 return;
392 Q_UNUSED(end)
419
393 // To be implemented
420 // int removedCount = end - start + 1;
421 if (m_count != -1 && start >= m_first + m_count) {
422 return;
423 } /*else {
424 int toRemove = qMin(m_series->count(), removedCount); // first find how many items can actually be removed
425 int first = qMax(start, m_first); // get the index of the first item that will be removed.
426 int last = qMin(first + toRemove - 1, m_series->count() + m_first - 1); // get the index of the last item that will be removed.
427 for (int i = last; i >= first; i--) {
428 m_series->remove(m_series->points().at(i - m_first));
429 }
430
431 if (m_count != -1) {
432 int itemsAvailable; // check how many are available to be added
433 if (m_orientation == Qt::Vertical)
434 itemsAvailable = m_model->rowCount() - m_first - m_series->count();
435 else
436 itemsAvailable = m_model->columnCount() - m_first - m_series->count();
437 int toBeAdded = qMin(itemsAvailable, m_count - m_series->count()); // add not more items than there is space left to be filled.
438 int currentSize = m_series->count();
439 if (toBeAdded > 0)
440 for (int i = m_series->count(); i < currentSize + toBeAdded; i++) {
441 QPointF point;
442 point.setX(m_model->data(xModelIndex(i), Qt::DisplayRole).toDouble());
443 point.setY(m_model->data(yModelIndex(i), Qt::DisplayRole).toDouble());
444 m_series->insert(i, point);
445 }
446 }
447 }*/
448 }
394 }
449
395
450 void QBarModelMapperPrivate::initializeBarFromModel()
396 void QBarModelMapperPrivate::initializeBarFromModel()
@@ -54,11 +54,6 public Q_SLOTS:
54 void modelColumnsAdded(QModelIndex parent, int start, int end);
54 void modelColumnsAdded(QModelIndex parent, int start, int end);
55 void modelColumnsRemoved(QModelIndex parent, int start, int end);
55 void modelColumnsRemoved(QModelIndex parent, int start, int end);
56
56
57 // // for the series
58 // void handlePointAdded(int pointPos);
59 // void handlePointRemoved(int pointPos);
60 // void handlePointReplaced(int pointPos);
61
62 void initializeBarFromModel();
57 void initializeBarFromModel();
63
58
64 private:
59 private:
@@ -39,7 +39,6 public:
39
39
40 int labelsRow() const;
40 int labelsRow() const;
41 void setLabelsRow(int labelsRow);
41 void setLabelsRow(int labelsRow);
42
43 };
42 };
44
43
45 QTCOMMERCIALCHART_END_NAMESPACE
44 QTCOMMERCIALCHART_END_NAMESPACE
@@ -27,6 +27,16
27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28
28
29 /*!
29 /*!
30 \class QPieModelMapper
31 \brief part of QtCommercial chart API.
32 \mainclass
33
34 The instance of this class cannot be created directly. QHPieModelMapper of QVPieModelMapper should be used instead. This class is used to create a connection between QPieSeries and QAbstractItemModel derived model object.
35 It is possible to use both QAbstractItemModel and QPieSeries model API. QPieModelMapper makes sure that Pie 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 /*!
30 \property QPieModelMapper::series
40 \property QPieModelMapper::series
31 \brief Defines the QPieSeries object that is used by the mapper.
41 \brief Defines the QPieSeries object that is used by the mapper.
32
42
@@ -54,16 +64,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE
54 */
64 */
55
65
56 /*!
66 /*!
57 \class QPieModelMapper
58 \brief part of QtCommercial chart API.
59 \mainclass
60
61 The instance of this class cannot be created directly. QHPieModelMapper of QVPieModelMapper should be used instead. This class is used to create a connection between QPieSeries and QAbstractItemModel derived model object.
62 It is possible to use both QAbstractItemModel and QPieSeries model API. QPieModelMapper makes sure that Pie and the model are kept in sync.
63 NOTE: used model has to support adding/removing rows/columns and modifying the data of the cells.
64 */
65
66 /*!
67 Constructs a mapper object which is a child of \a parent.
67 Constructs a mapper object which is a child of \a parent.
68 */
68 */
69 QPieModelMapper::QPieModelMapper(QObject *parent) :
69 QPieModelMapper::QPieModelMapper(QObject *parent) :
@@ -581,7 +581,6 void QPieModelMapperPrivate::initializePieFromModel()
581 connect(slice, SIGNAL(valueChanged()), this, SLOT(sliceValueChanged()));
581 connect(slice, SIGNAL(valueChanged()), this, SLOT(sliceValueChanged()));
582 m_series->append(slice);
582 m_series->append(slice);
583 m_slices.append(slice);
583 m_slices.append(slice);
584 // m_series->append(m_model->data(labelIndex, Qt::DisplayRole).toString(), m_model->data(valueIndex, Qt::DisplayRole).toDouble());
585 slicePos++;
584 slicePos++;
586 valueIndex = valueModelIndex(slicePos);
585 valueIndex = valueModelIndex(slicePos);
587 labelIndex = labelModelIndex(slicePos);
586 labelIndex = labelModelIndex(slicePos);
@@ -39,7 +39,6 public:
39
39
40 int yRow() const;
40 int yRow() const;
41 void setYRow(int yRow);
41 void setYRow(int yRow);
42
43 };
42 };
44
43
45 QTCOMMERCIALCHART_END_NAMESPACE
44 QTCOMMERCIALCHART_END_NAMESPACE
@@ -27,7 +27,9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27 \brief part of QtCommercial chart API.
27 \brief part of QtCommercial chart API.
28 \mainclass
28 \mainclass
29
29
30 Nothing here yet
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.
32 NOTE: used model has to support adding/removing rows/columns and modifying the data of the cells.
31 */
33 */
32
34
33 /*!
35 /*!
@@ -39,7 +39,6 public:
39
39
40 int yColumn() const;
40 int yColumn() const;
41 void setYColumn(int yColumn);
41 void setYColumn(int yColumn);
42
43 };
42 };
44
43
45 QTCOMMERCIALCHART_END_NAMESPACE
44 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now