##// END OF EJS Templates
PieSeries won't crash anymore if mapped columns/rows are not existing
Marek Rosa -
r1086:c79a09d1d08f
parent child
Show More
@@ -701,7 +701,10 void QPieSeriesPrivate::initializePieFromModel()
701 q->clear();
701 q->clear();
702
702
703 // create the initial slices set
703 // create the initial slices set
704 if (m_mapOrientation == Qt::Vertical) {
704 if (m_mapOrientation == Qt::Vertical) {
705 if (m_mapValues >= m_model->columnCount() || m_mapLabels >= m_model->columnCount())
706 return; // mapped columns are not existing
707
705 int sliceCount = 0;
708 int sliceCount = 0;
706 if(m_mapCount == -1)
709 if(m_mapCount == -1)
707 sliceCount = m_model->rowCount() - m_mapFirst;
710 sliceCount = m_model->rowCount() - m_mapFirst;
@@ -710,6 +713,9 void QPieSeriesPrivate::initializePieFromModel()
710 for (int i = m_mapFirst; i < m_mapFirst + sliceCount; i++)
713 for (int i = m_mapFirst; i < m_mapFirst + sliceCount; i++)
711 q->append(m_model->data(m_model->index(i, m_mapValues), Qt::DisplayRole).toDouble(), m_model->data(m_model->index(i, m_mapLabels), Qt::DisplayRole).toString());
714 q->append(m_model->data(m_model->index(i, m_mapValues), Qt::DisplayRole).toDouble(), m_model->data(m_model->index(i, m_mapLabels), Qt::DisplayRole).toString());
712 } else {
715 } else {
716 if (m_mapValues >= m_model->rowCount() || m_mapLabels >= m_model->rowCount())
717 return; // mapped columns are not existing
718
713 int sliceCount = 0;
719 int sliceCount = 0;
714 if(m_mapCount == -1)
720 if(m_mapCount == -1)
715 sliceCount = m_model->columnCount() - m_mapFirst;
721 sliceCount = m_model->columnCount() - m_mapFirst;
General Comments 0
You need to be logged in to leave comments. Login now