##// END OF EJS Templates
Removed unnecessary model related function from xyseries and pieseries
Marek Rosa -
r1166:740d4c3988ce
parent child
Show More
@@ -439,8 +439,15 void QPieSeries::setModel(QAbstractItemModel* model)
439 if(model)
439 if(model)
440 {
440 {
441 d->m_model = model;
441 d->m_model = model;
442 // connect signals from the model
443 connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex)));
444 connect(d->m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int)));
445 connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
446 connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int)));
447 connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
448
442 if (d->m_mapper)
449 if (d->m_mapper)
443 d->setMapping();
450 d->initializePieFromModel();
444 }
451 }
445 else
452 else
446 {
453 {
@@ -458,8 +465,11 void QPieSeries::setModelMapper(QPieModelMapper *mapper)
458
465
459 if (mapper) {
466 if (mapper) {
460 d->m_mapper = mapper;
467 d->m_mapper = mapper;
468 // connect the signal from the mapper
469 connect(d->m_mapper, SIGNAL(updated()), d, SLOT(initializePieFromModel()));
470
461 if (d->m_model)
471 if (d->m_model)
462 d->setMapping();
472 d->initializePieFromModel();
463 } else {
473 } else {
464 d->m_mapper = 0;
474 d->m_mapper = 0;
465 }
475 }
@@ -560,24 +570,26 void QPieSeriesPrivate::sliceHovered(bool state)
560
570
561 void QPieSeriesPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
571 void QPieSeriesPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
562 {
572 {
563 for (int row = topLeft.row(); row <= bottomRight.row(); row++) {
573 if (m_mapper) {
564 for (int column = topLeft.column(); column <= bottomRight.column(); column++) {
574 for (int row = topLeft.row(); row <= bottomRight.row(); row++) {
565 if (m_mapper->orientation() == Qt::Vertical)
575 for (int column = topLeft.column(); column <= bottomRight.column(); column++) {
566 {
576 if (m_mapper->orientation() == Qt::Vertical)
567 if ( topLeft.row() >= m_mapper->first() && (m_mapper->count() == - 1 || topLeft.row() < m_mapper->first() + m_mapper->count())) {
577 {
568 if (topLeft.column() == m_mapper->mapValues())
578 if ( topLeft.row() >= m_mapper->first() && (m_mapper->count() == - 1 || topLeft.row() < m_mapper->first() + m_mapper->count())) {
569 m_slices.at(topLeft.row() - m_mapper->first())->setValue(m_model->data(topLeft, Qt::DisplayRole).toDouble());
579 if (topLeft.column() == m_mapper->mapValues())
570 if (topLeft.column() == m_mapper->mapLabels())
580 m_slices.at(topLeft.row() - m_mapper->first())->setValue(m_model->data(topLeft, Qt::DisplayRole).toDouble());
571 m_slices.at(topLeft.row() - m_mapper->first())->setLabel(m_model->data(topLeft, Qt::DisplayRole).toString());
581 if (topLeft.column() == m_mapper->mapLabels())
582 m_slices.at(topLeft.row() - m_mapper->first())->setLabel(m_model->data(topLeft, Qt::DisplayRole).toString());
583 }
572 }
584 }
573 }
585 else
574 else
586 {
575 {
587 if (topLeft.column() >= m_mapper->first() && (m_mapper->count() == - 1 || topLeft.column() < m_mapper->first() + m_mapper->count())) {
576 if (topLeft.column() >= m_mapper->first() && (m_mapper->count() == - 1 || topLeft.column() < m_mapper->first() + m_mapper->count())) {
588 if (topLeft.row() == m_mapper->mapValues())
577 if (topLeft.row() == m_mapper->mapValues())
589 m_slices.at(topLeft.column() - m_mapper->first())->setValue(m_model->data(topLeft, Qt::DisplayRole).toDouble());
578 m_slices.at(topLeft.column() - m_mapper->first())->setValue(m_model->data(topLeft, Qt::DisplayRole).toDouble());
590 if (topLeft.row() == m_mapper->mapLabels())
579 if (topLeft.row() == m_mapper->mapLabels())
591 m_slices.at(topLeft.column() - m_mapper->first())->setLabel(m_model->data(topLeft, Qt::DisplayRole).toString());
580 m_slices.at(topLeft.column() - m_mapper->first())->setLabel(m_model->data(topLeft, Qt::DisplayRole).toString());
592 }
581 }
593 }
582 }
594 }
583 }
595 }
@@ -588,121 +600,118 void QPieSeriesPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRigh
588 void QPieSeriesPrivate::modelRowsAdded(QModelIndex parent, int start, int end)
600 void QPieSeriesPrivate::modelRowsAdded(QModelIndex parent, int start, int end)
589 {
601 {
590 Q_UNUSED(parent);
602 Q_UNUSED(parent);
591 if (m_mapper->orientation() == Qt::Vertical)
603 if (m_mapper) {
592 insertData(start, end);
604 if (m_mapper->orientation() == Qt::Vertical)
593 else if (start <= m_mapper->mapValues() || start <= m_mapper->mapLabels()) // if the changes affect the map - reinitialize the pie
605 insertData(start, end);
594 initializePieFromModel();
606 else if (start <= m_mapper->mapValues() || start <= m_mapper->mapLabels()) // if the changes affect the map - reinitialize the pie
607 initializePieFromModel();
608 }
595 }
609 }
596
610
597 void QPieSeriesPrivate::modelRowsRemoved(QModelIndex parent, int start, int end)
611 void QPieSeriesPrivate::modelRowsRemoved(QModelIndex parent, int start, int end)
598 {
612 {
599 Q_UNUSED(parent);
613 Q_UNUSED(parent);
600 if (m_mapper->orientation() == Qt::Vertical)
614 if (m_mapper) {
601 removeData(start, end);
615 if (m_mapper->orientation() == Qt::Vertical)
602 else if (start <= m_mapper->mapValues() || start <= m_mapper->mapLabels()) // if the changes affect the map - reinitialize the pie
616 removeData(start, end);
603 initializePieFromModel();
617 else if (start <= m_mapper->mapValues() || start <= m_mapper->mapLabels()) // if the changes affect the map - reinitialize the pie
618 initializePieFromModel();
619 }
604 }
620 }
605
621
606 void QPieSeriesPrivate::modelColumnsAdded(QModelIndex parent, int start, int end)
622 void QPieSeriesPrivate::modelColumnsAdded(QModelIndex parent, int start, int end)
607 {
623 {
608 Q_UNUSED(parent);
624 Q_UNUSED(parent);
609 if (m_mapper->orientation() == Qt::Horizontal)
625 if (m_mapper) {
610 insertData(start, end);
626 if (m_mapper->orientation() == Qt::Horizontal)
611 else if (start <= m_mapper->mapValues() || start <= m_mapper->mapLabels()) // if the changes affect the map - reinitialize the pie
627 insertData(start, end);
612 initializePieFromModel();
628 else if (start <= m_mapper->mapValues() || start <= m_mapper->mapLabels()) // if the changes affect the map - reinitialize the pie
629 initializePieFromModel();
630 }
613 }
631 }
614
632
615 void QPieSeriesPrivate::modelColumnsRemoved(QModelIndex parent, int start, int end)
633 void QPieSeriesPrivate::modelColumnsRemoved(QModelIndex parent, int start, int end)
616 {
634 {
617 Q_UNUSED(parent);
635 Q_UNUSED(parent);
618 if (m_mapper->orientation() == Qt::Horizontal)
636 if (m_mapper) {
619 removeData(start, end);
637 if (m_mapper->orientation() == Qt::Horizontal)
620 else if (start <= m_mapper->mapValues() || start <= m_mapper->mapLabels()) // if the changes affect the map - reinitialize the pie
638 removeData(start, end);
621 initializePieFromModel();
639 else if (start <= m_mapper->mapValues() || start <= m_mapper->mapLabels()) // if the changes affect the map - reinitialize the pie
640 initializePieFromModel();
641 }
622 }
642 }
623
643
624 void QPieSeriesPrivate::insertData(int start, int end)
644 void QPieSeriesPrivate::insertData(int start, int end)
625 {
645 {
626 Q_Q(QPieSeries);
646 Q_Q(QPieSeries);
627 if (m_mapper->count() != -1 && start >= m_mapper->first() + m_mapper->count()) {
647 if (m_mapper) {
628 return;
648 if (m_mapper->count() != -1 && start >= m_mapper->first() + m_mapper->count()) {
629 } else {
649 return;
630 int addedCount = end - start + 1;
650 } else {
631 if (m_mapper->count() != -1 && addedCount > m_mapper->count())
651 int addedCount = end - start + 1;
632 addedCount = m_mapper->count();
652 if (m_mapper->count() != -1 && addedCount > m_mapper->count())
633 int first = qMax(start, m_mapper->first());
653 addedCount = m_mapper->count();
634 int last = qMin(first + addedCount - 1, m_mapper->orientation() == Qt::Vertical ? m_model->rowCount() - 1 : m_model->columnCount() - 1);
654 int first = qMax(start, m_mapper->first());
635 for (int i = first; i <= last; i++) {
655 int last = qMin(first + addedCount - 1, m_mapper->orientation() == Qt::Vertical ? m_model->rowCount() - 1 : m_model->columnCount() - 1);
636 QPieSlice *slice = new QPieSlice;
656 for (int i = first; i <= last; i++) {
637 if (m_mapper->orientation() == Qt::Vertical) {
657 QPieSlice *slice = new QPieSlice;
638 slice->setValue(m_model->data(m_model->index(i, m_mapper->mapValues()), Qt::DisplayRole).toDouble());
658 if (m_mapper->orientation() == Qt::Vertical) {
639 slice->setLabel(m_model->data(m_model->index(i, m_mapper->mapLabels()), Qt::DisplayRole).toString());
659 slice->setValue(m_model->data(m_model->index(i, m_mapper->mapValues()), Qt::DisplayRole).toDouble());
640 } else {
660 slice->setLabel(m_model->data(m_model->index(i, m_mapper->mapLabels()), Qt::DisplayRole).toString());
641 slice->setValue(m_model->data(m_model->index(m_mapper->mapValues(), i), Qt::DisplayRole).toDouble());
661 } else {
642 slice->setLabel(m_model->data(m_model->index(m_mapper->mapLabels(), i), Qt::DisplayRole).toString());
662 slice->setValue(m_model->data(m_model->index(m_mapper->mapValues(), i), Qt::DisplayRole).toDouble());
663 slice->setLabel(m_model->data(m_model->index(m_mapper->mapLabels(), i), Qt::DisplayRole).toString());
664 }
665 slice->setLabelVisible();
666 q->insert(i - m_mapper->first(), slice);
643 }
667 }
644 slice->setLabelVisible();
668 if (m_mapper->count() != -1 && m_slices.size() > m_mapper->count())
645 q->insert(i - m_mapper->first(), slice);
669 for (int i = m_slices.size() - 1; i >= m_mapper->count(); i--)
670 q->remove(q->slices().at(i));
646 }
671 }
647 if (m_mapper->count() != -1 && m_slices.size() > m_mapper->count())
648 for (int i = m_slices.size() - 1; i >= m_mapper->count(); i--)
649 q->remove(q->slices().at(i));
650 }
672 }
651 }
673 }
652
674
653 void QPieSeriesPrivate::removeData(int start, int end)
675 void QPieSeriesPrivate::removeData(int start, int end)
654 {
676 {
655 Q_Q(QPieSeries);
677 Q_Q(QPieSeries);
656 int removedCount = end - start + 1;
678 if (m_mapper) {
657 if (m_mapper->count() != -1 && start >= m_mapper->first() + m_mapper->count()) {
679 int removedCount = end - start + 1;
658 return;
680 if (m_mapper->count() != -1 && start >= m_mapper->first() + m_mapper->count()) {
659 } else {
681 return;
660 int toRemove = qMin(m_slices.size(), removedCount); // first find how many items can actually be removed
682 } else {
661 int first = qMax(start, m_mapper->first()); // get the index of the first item that will be removed.
683 int toRemove = qMin(m_slices.size(), removedCount); // first find how many items can actually be removed
662 int last = qMin(first + toRemove - 1, m_slices.size() + m_mapper->first() - 1); // get the index of the last item that will be removed.
684 int first = qMax(start, m_mapper->first()); // get the index of the first item that will be removed.
663 for (int i = last; i >= first; i--)
685 int last = qMin(first + toRemove - 1, m_slices.size() + m_mapper->first() - 1); // get the index of the last item that will be removed.
664 q->remove(q->slices().at(i - m_mapper->first()));
686 for (int i = last; i >= first; i--)
665
687 q->remove(q->slices().at(i - m_mapper->first()));
666 if (m_mapper->count() != -1) {
688
667 int itemsAvailable; // check how many are available to be added
689 if (m_mapper->count() != -1) {
668 if (m_mapper->orientation() == Qt::Vertical)
690 int itemsAvailable; // check how many are available to be added
669 itemsAvailable = m_model->rowCount() - m_mapper->first() - m_slices.size();
691 if (m_mapper->orientation() == Qt::Vertical)
670 else
692 itemsAvailable = m_model->rowCount() - m_mapper->first() - m_slices.size();
671 itemsAvailable = m_model->columnCount() - m_mapper->first() - m_slices.size();
693 else
672 int toBeAdded = qMin(itemsAvailable, m_mapper->count() - m_slices.size()); // add not more items than there is space left to be filled.
694 itemsAvailable = m_model->columnCount() - m_mapper->first() - m_slices.size();
673 int currentSize = m_slices.size();
695 int toBeAdded = qMin(itemsAvailable, m_mapper->count() - m_slices.size()); // add not more items than there is space left to be filled.
674 if (toBeAdded > 0)
696 int currentSize = m_slices.size();
675 for (int i = m_slices.size(); i < currentSize + toBeAdded; i++) {
697 if (toBeAdded > 0)
676 QPieSlice *slice = new QPieSlice;
698 for (int i = m_slices.size(); i < currentSize + toBeAdded; i++) {
677 if (m_mapper->orientation() == Qt::Vertical) {
699 QPieSlice *slice = new QPieSlice;
678 slice->setValue(m_model->data(m_model->index(i + m_mapper->first(), m_mapper->mapValues()), Qt::DisplayRole).toDouble());
700 if (m_mapper->orientation() == Qt::Vertical) {
679 slice->setLabel(m_model->data(m_model->index(i + m_mapper->first(), m_mapper->mapLabels()), Qt::DisplayRole).toString());
701 slice->setValue(m_model->data(m_model->index(i + m_mapper->first(), m_mapper->mapValues()), Qt::DisplayRole).toDouble());
680 } else {
702 slice->setLabel(m_model->data(m_model->index(i + m_mapper->first(), m_mapper->mapLabels()), Qt::DisplayRole).toString());
681 slice->setValue(m_model->data(m_model->index(m_mapper->mapValues(), i + m_mapper->first()), Qt::DisplayRole).toDouble());
703 } else {
682 slice->setLabel(m_model->data(m_model->index(m_mapper->mapLabels(), i + m_mapper->first()), Qt::DisplayRole).toString());
704 slice->setValue(m_model->data(m_model->index(m_mapper->mapValues(), i + m_mapper->first()), Qt::DisplayRole).toDouble());
705 slice->setLabel(m_model->data(m_model->index(m_mapper->mapLabels(), i + m_mapper->first()), Qt::DisplayRole).toString());
706 }
707 slice->setLabelVisible();
708 q->insert(i, slice);
683 }
709 }
684 slice->setLabelVisible();
710 }
685 q->insert(i, slice);
686 }
687 }
711 }
688 }
712 }
689 }
713 }
690
714
691 void QPieSeriesPrivate::setMapping()
692 {
693 initializePieFromModel();
694
695 // connect signals from the model
696 connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(modelUpdated(QModelIndex,QModelIndex)));
697 connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(modelRowsAdded(QModelIndex,int,int)));
698 connect(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(modelRowsRemoved(QModelIndex,int,int)));
699 connect(m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), this, SLOT(modelColumnsAdded(QModelIndex,int,int)));
700 connect(m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), this, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
701
702 // connect the signal from the mapper
703 connect(m_mapper, SIGNAL(updated()), this, SLOT(initializePieFromModel()));
704 }
705
706 void QPieSeriesPrivate::initializePieFromModel()
715 void QPieSeriesPrivate::initializePieFromModel()
707 {
716 {
708 Q_Q(QPieSeries);
717 Q_Q(QPieSeries);
@@ -65,7 +65,6 public Q_SLOTS:
65 bool setRealValue(qreal &value, qreal newValue, qreal max, qreal min = 0.0);
65 bool setRealValue(qreal &value, qreal newValue, qreal max, qreal min = 0.0);
66
66
67 private:
67 private:
68 void setMapping();
69 void insertData(int start, int end);
68 void insertData(int start, int end);
70 void removeData(int start, int end);
69 void removeData(int start, int end);
71
70
@@ -339,8 +339,14 void QXYSeries::setModel(QAbstractItemModel *model)
339 // set new model
339 // set new model
340 if (model) {
340 if (model) {
341 d->m_model = model;
341 d->m_model = model;
342 if (d->m_mapper)
342 emit d->reinitialized();
343 d->setMapping();
343
344 // connect signals from the model
345 connect(d->m_model,SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex)));
346 connect(d->m_model,SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int)));
347 connect(d->m_model,SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
348 connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int)));
349 connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
344 } else {
350 } else {
345 d->m_model = 0;
351 d->m_model = 0;
346 }
352 }
@@ -356,8 +362,10 void QXYSeries::setModelMapper(QXYModelMapper *mapper)
356
362
357 if (mapper) {
363 if (mapper) {
358 d->m_mapper = mapper;
364 d->m_mapper = mapper;
359 if (d->m_model)
365 emit d->reinitialized();
360 d->setMapping();
366
367 // connect the signal from the mapper
368 connect(d->m_mapper, SIGNAL(updated()), d, SLOT(mappingUpdated()));
361 } else {
369 } else {
362 d->m_mapper = 0;
370 d->m_mapper = 0;
363 }
371 }
@@ -438,38 +446,28 QList<LegendMarker*> QXYSeriesPrivate::createLegendMarker(QLegend* legend)
438 return list << new XYLegendMarker(q,legend);
446 return list << new XYLegendMarker(q,legend);
439 }
447 }
440
448
441 void QXYSeriesPrivate::setMapping()
442 {
443 // connect signals from the model
444 connect(m_model,SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(modelUpdated(QModelIndex,QModelIndex)));
445 connect(m_model,SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(modelRowsAdded(QModelIndex,int,int)));
446 connect(m_model,SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(modelRowsRemoved(QModelIndex,int,int)));
447 connect(m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), this, SLOT(modelColumnsAdded(QModelIndex,int,int)));
448 connect(m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), this, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
449
450 // connect the signal from the mapper
451 connect(m_mapper, SIGNAL(updated()), this, SLOT(mappingUpdated()));
452 }
453
454 void QXYSeriesPrivate::mappingUpdated()
449 void QXYSeriesPrivate::mappingUpdated()
455 {
450 {
456 emit reinitialized();
451 if (m_model)
452 emit reinitialized();
457 }
453 }
458
454
459 void QXYSeriesPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
455 void QXYSeriesPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
460 {
456 {
461 for (int row = topLeft.row(); row <= bottomRight.row(); row++) {
457 if (m_mapper) {
462 for (int column = topLeft.column(); column <= bottomRight.column(); column++) {
458 for (int row = topLeft.row(); row <= bottomRight.row(); row++) {
463 if (m_mapper->orientation() == Qt::Vertical) {
459 for (int column = topLeft.column(); column <= bottomRight.column(); column++) {
464 if ((column == m_mapper->mapX() || column == m_mapper->mapY()) // modified item is in a mapped column
460 if (m_mapper->orientation() == Qt::Vertical) {
465 && row >= m_mapper->first() // modfied item in not before first item
461 if ((column == m_mapper->mapX() || column == m_mapper->mapY()) // modified item is in a mapped column
466 && (m_mapper->count() == -1 || row < m_mapper->first() + m_mapper->count())) // map is not limited or item lays before the end of map
462 && row >= m_mapper->first() // modfied item in not before first item
467 emit pointReplaced(row - m_mapper->first());
463 && (m_mapper->count() == -1 || row < m_mapper->first() + m_mapper->count())) // map is not limited or item lays before the end of map
468 } else {
464 emit pointReplaced(row - m_mapper->first());
469 if ((row == m_mapper->mapX() || row == m_mapper->mapY()) // modified item is in a mapped row
465 } else {
470 && column >= m_mapper->first() // modfied item in not before first item
466 if ((row == m_mapper->mapX() || row == m_mapper->mapY()) // modified item is in a mapped row
471 && (m_mapper->count() == -1 || column < m_mapper->first() + m_mapper->count())) // map is not limited or item lays before the end of map
467 && column >= m_mapper->first() // modfied item in not before first item
472 emit pointReplaced(column - m_mapper->first());
468 && (m_mapper->count() == -1 || column < m_mapper->first() + m_mapper->count())) // map is not limited or item lays before the end of map
469 emit pointReplaced(column - m_mapper->first());
470 }
473 }
471 }
474 }
472 }
475 }
473 }
@@ -479,37 +477,45 void QXYSeriesPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight
479 void QXYSeriesPrivate::modelRowsAdded(QModelIndex parent, int start, int end)
477 void QXYSeriesPrivate::modelRowsAdded(QModelIndex parent, int start, int end)
480 {
478 {
481 Q_UNUSED(parent);
479 Q_UNUSED(parent);
482 if (m_mapper->orientation() == Qt::Vertical)
480 if (m_mapper) {
483 emit pointsAdded(start, end);
481 if (m_mapper->orientation() == Qt::Vertical)
484 else if (start <= m_mapper->mapX() || start <= m_mapper->mapY())
482 emit pointsAdded(start, end);
485 emit reinitialized();
483 else if (start <= m_mapper->mapX() || start <= m_mapper->mapY())
484 emit reinitialized();
485 }
486 }
486 }
487
487
488 void QXYSeriesPrivate::modelRowsRemoved(QModelIndex parent, int start, int end)
488 void QXYSeriesPrivate::modelRowsRemoved(QModelIndex parent, int start, int end)
489 {
489 {
490 Q_UNUSED(parent);
490 Q_UNUSED(parent);
491 if (m_mapper->orientation() == Qt::Vertical)
491 if (m_mapper) {
492 emit pointsRemoved(start, end);
492 if (m_mapper->orientation() == Qt::Vertical)
493 else if (start <= m_mapper->mapX() || start <= m_mapper->mapY())
493 emit pointsRemoved(start, end);
494 emit reinitialized();
494 else if (start <= m_mapper->mapX() || start <= m_mapper->mapY())
495 emit reinitialized();
496 }
495 }
497 }
496
498
497 void QXYSeriesPrivate::modelColumnsAdded(QModelIndex parent, int start, int end)
499 void QXYSeriesPrivate::modelColumnsAdded(QModelIndex parent, int start, int end)
498 {
500 {
499 Q_UNUSED(parent);
501 Q_UNUSED(parent);
500 if (m_mapper->orientation() == Qt::Horizontal)
502 if (m_mapper) {
501 emit pointsAdded(start, end);
503 if (m_mapper->orientation() == Qt::Horizontal)
502 else if (start <= m_mapper->mapX() || start <= m_mapper->mapY())
504 emit pointsAdded(start, end);
503 emit reinitialized();
505 else if (start <= m_mapper->mapX() || start <= m_mapper->mapY())
506 emit reinitialized();
507 }
504 }
508 }
505
509
506 void QXYSeriesPrivate::modelColumnsRemoved(QModelIndex parent, int start, int end)
510 void QXYSeriesPrivate::modelColumnsRemoved(QModelIndex parent, int start, int end)
507 {
511 {
508 Q_UNUSED(parent);
512 Q_UNUSED(parent);
509 if (m_mapper->orientation() == Qt::Horizontal)
513 if (m_mapper) {
510 emit pointsRemoved(start, end);
514 if (m_mapper->orientation() == Qt::Horizontal)
511 else if (start <= m_mapper->mapX() || start <= m_mapper->mapY())
515 emit pointsRemoved(start, end);
512 emit reinitialized();
516 else if (start <= m_mapper->mapX() || start <= m_mapper->mapY())
517 emit reinitialized();
518 }
513 }
519 }
514
520
515 #include "moc_qxyseries.cpp"
521 #include "moc_qxyseries.cpp"
@@ -56,7 +56,6 protected Q_SLOTS:
56 virtual void mappingUpdated();
56 virtual void mappingUpdated();
57
57
58 private:
58 private:
59 void setMapping();
60 void insertData(int start, int end);
59 void insertData(int start, int end);
61 void removeData(int start, int end);
60 void removeData(int start, int end);
62
61
General Comments 0
You need to be logged in to leave comments. Login now