|
@@
-195,6
+195,22
QPieSlice* QPieSeries::add(qreal value, QString name)
|
|
195
|
return slice;
|
|
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
|
Removes a single \a slice from the series and deletes the slice.
|
|
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
|
void QPieSeries::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
|
|
589
|
void QPieSeries::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
|
|
574
|
{
|
|
590
|
{
|
|
575
|
if (m_mapOrientation == Qt::Vertical)
|
|
591
|
if (m_mapOrientation == Qt::Vertical)
|
|
|
|
|
592
|
{
|
|
576
|
// slices().at(topLeft.row())->setValue(m_model->data(m_model->index(topLeft.row(), topLeft.column()), Qt::DisplayRole).toDouble());
|
|
593
|
// slices().at(topLeft.row())->setValue(m_model->data(m_model->index(topLeft.row(), topLeft.column()), Qt::DisplayRole).toDouble());
|
|
577
|
if (topLeft.column() == m_mapValues)
|
|
594
|
if (topLeft.column() == m_mapValues)
|
|
578
|
slices().at(topLeft.row())->setValue(m_model->data(topLeft, Qt::DisplayRole).toDouble());
|
|
595
|
slices().at(topLeft.row())->setValue(m_model->data(topLeft, Qt::DisplayRole).toDouble());
|
|
579
|
else if (topLeft.column() == m_mapLabels)
|
|
596
|
else if (topLeft.column() == m_mapLabels)
|
|
580
|
slices().at(topLeft.row())->setLabel(m_model->data(topLeft, Qt::DisplayRole).toString());
|
|
597
|
slices().at(topLeft.row())->setLabel(m_model->data(topLeft, Qt::DisplayRole).toString());
|
|
581
|
else
|
|
598
|
}
|
|
582
|
// slices().at(topLeft.column())->setValue(m_model->data(m_model->index(topLeft.row(), topLeft.column()), Qt::DisplayRole).toDouble());
|
|
599
|
else
|
|
583
|
if (topLeft.column() == m_mapValues)
|
|
600
|
{
|
|
584
|
slices().at(topLeft.column())->setValue(m_model->data(topLeft, Qt::DisplayRole).toDouble());
|
|
601
|
// slices().at(topLeft.column())->setValue(m_model->data(m_model->index(topLeft.row(), topLeft.column()), Qt::DisplayRole).toDouble());
|
|
585
|
else if (topLeft.column() == m_mapLabels)
|
|
602
|
if (topLeft.column() == m_mapValues)
|
|
586
|
slices().at(topLeft.column())->setLabel(m_model->data(topLeft, Qt::DisplayRole).toString());
|
|
603
|
slices().at(topLeft.column())->setValue(m_model->data(topLeft, Qt::DisplayRole).toDouble());
|
|
|
|
|
604
|
else if (topLeft.column() == m_mapLabels)
|
|
|
|
|
605
|
slices().at(topLeft.column())->setLabel(m_model->data(topLeft, Qt::DisplayRole).toString());
|
|
|
|
|
606
|
}
|
|
587
|
}
|
|
607
|
}
|
|
588
|
|
|
608
|
|
|
589
|
void QPieSeries::modelDataAdded(QModelIndex parent, int start, int end)
|
|
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
|
void QPieSeries::modelDataRemoved(QModelIndex parent, int start, int end)
|
|
627
|
void QPieSeries::modelDataRemoved(QModelIndex parent, int start, int end)
|