@@ -120,8 +120,8 bool CustomTableModel::insertRows ( int row, int count, const QModelIndex & pare | |||
|
120 | 120 | beginInsertRows(QModelIndex(), row /*dataTable.count()*/, row + count - 1); |
|
121 | 121 | for (int i = row; i < row + count; i++) |
|
122 | 122 | { |
|
123 | m_points.insert(row, QPointF()); | |
|
124 | m_labels.insert(row,("")); | |
|
123 | m_points.insert(row, QPointF(10,20)); | |
|
124 | m_labels.insert(row,("a")); | |
|
125 | 125 | } |
|
126 | 126 | endInsertRows(); |
|
127 | 127 | return true; |
@@ -195,6 +195,22 QPieSlice* QPieSeries::add(qreal value, QString name) | |||
|
195 | 195 | return slice; |
|
196 | 196 | } |
|
197 | 197 | |
|
198 | void QPieSeries::insert(int i, QPieSlice* slice) | |
|
199 | { | |
|
200 | Q_ASSERT(i <= m_slices.count()); | |
|
201 | slice->setParent(this); | |
|
202 | m_slices.insert(i, slice); | |
|
203 | ||
|
204 | updateDerivativeData(); | |
|
205 | ||
|
206 | connect(slice, SIGNAL(changed()), this, SLOT(sliceChanged())); | |
|
207 | connect(slice, SIGNAL(clicked()), this, SLOT(sliceClicked())); | |
|
208 | connect(slice, SIGNAL(hoverEnter()), this, SLOT(sliceHoverEnter())); | |
|
209 | connect(slice, SIGNAL(hoverLeave()), this, SLOT(sliceHoverLeave())); | |
|
210 | ||
|
211 | emit changed(); | |
|
212 | } | |
|
213 | ||
|
198 | 214 | /*! |
|
199 | 215 | Removes a single \a slice from the series and deletes the slice. |
|
200 | 216 | |
@@ -573,22 +589,39 void QPieSeries::setModelMapping(int modelValuesLine, int modelLabelsLine, Qt::O | |||
|
573 | 589 | void QPieSeries::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight) |
|
574 | 590 | { |
|
575 | 591 | if (m_mapOrientation == Qt::Vertical) |
|
592 | { | |
|
576 | 593 | // slices().at(topLeft.row())->setValue(m_model->data(m_model->index(topLeft.row(), topLeft.column()), Qt::DisplayRole).toDouble()); |
|
577 | 594 | if (topLeft.column() == m_mapValues) |
|
578 | 595 | slices().at(topLeft.row())->setValue(m_model->data(topLeft, Qt::DisplayRole).toDouble()); |
|
579 | 596 | else if (topLeft.column() == m_mapLabels) |
|
580 | 597 | slices().at(topLeft.row())->setLabel(m_model->data(topLeft, Qt::DisplayRole).toString()); |
|
598 | } | |
|
581 | 599 |
|
|
600 | { | |
|
582 | 601 |
|
|
583 | 602 |
|
|
584 | 603 |
|
|
585 | 604 |
|
|
586 | 605 |
|
|
587 | 606 | } |
|
607 | } | |
|
588 | 608 | |
|
589 | 609 | void QPieSeries::modelDataAdded(QModelIndex parent, int start, int end) |
|
590 | 610 | { |
|
591 | // | |
|
611 | QPieSlice* newSlice = new QPieSlice; | |
|
612 | newSlice->setLabelVisible(true); | |
|
613 | if (m_mapOrientation == Qt::Vertical) | |
|
614 | { | |
|
615 | newSlice->setValue(m_model->data(m_model->index(start, m_mapValues), Qt::DisplayRole).toDouble()); | |
|
616 | newSlice->setLabel(m_model->data(m_model->index(start, m_mapLabels), Qt::DisplayRole).toString()); | |
|
617 | } | |
|
618 | else | |
|
619 | { | |
|
620 | newSlice->setValue(m_model->data(m_model->index(m_mapValues, start), Qt::DisplayRole).toDouble()); | |
|
621 | newSlice->setLabel(m_model->data(m_model->index(m_mapLabels, start), Qt::DisplayRole).toString()); | |
|
622 | } | |
|
623 | ||
|
624 | insert(start, newSlice); | |
|
592 | 625 | } |
|
593 | 626 | |
|
594 | 627 | void QPieSeries::modelDataRemoved(QModelIndex parent, int start, int end) |
General Comments 0
You need to be logged in to leave comments.
Login now