diff --git a/examples/piechartdrilldown/main.cpp b/examples/piechartdrilldown/main.cpp index a48af78..8aa96e7 100644 --- a/examples/piechartdrilldown/main.cpp +++ b/examples/piechartdrilldown/main.cpp @@ -60,7 +60,7 @@ int main(int argc, char *argv[]) QObject::connect(series, SIGNAL(clicked(QPieSlice*, Qt::MouseButtons)), chart, SLOT(handleSliceClicked(QPieSlice*))); - *yearSeries << new DrilldownSlice(series->total(), name, series); + *yearSeries << new DrilldownSlice(series->sum(), name, series); } QObject::connect(yearSeries, SIGNAL(clicked(QPieSlice*, Qt::MouseButtons)), chart, SLOT(handleSliceClicked(QPieSlice*))); diff --git a/src/piechart/qpieseries.cpp b/src/piechart/qpieseries.cpp index b99950b..29551a4 100644 --- a/src/piechart/qpieseries.cpp +++ b/src/piechart/qpieseries.cpp @@ -380,10 +380,10 @@ void QPieSeries::setLabelsVisible(bool visible) \sa QPieSlice::value(), QPieSlice::setValue() */ -qreal QPieSeries::total() const +qreal QPieSeries::sum() const { Q_D(const QPieSeries); - return d->m_total; + return d->m_sum; } /*! @@ -520,7 +520,7 @@ QPieSeriesPrivate::QPieSeriesPrivate(QPieSeries *parent) m_pieRelativeSize(0.7), m_pieStartAngle(0), m_pieEndAngle(360), - m_total(0), + m_sum(0), m_mapValues(0), m_mapLabels(0), m_mapOrientation(Qt::Horizontal) @@ -535,18 +535,18 @@ QPieSeriesPrivate::~QPieSeriesPrivate() void QPieSeriesPrivate::updateDerivativeData() { - m_total = 0; + m_sum = 0; // nothing to do? if (m_slices.count() == 0) return; - // calculate total + // calculate sum of all slices foreach (QPieSlice* s, m_slices) - m_total += s->value(); + m_sum += s->value(); // nothing to show.. - if (qFuzzyIsNull(m_total)) + if (qFuzzyIsNull(m_sum)) return; // update slice attributes @@ -556,7 +556,7 @@ void QPieSeriesPrivate::updateDerivativeData() foreach (QPieSlice* s, m_slices) { PieSliceData data = PieSliceData::data(s); - data.m_percentage = s->value() / m_total; + data.m_percentage = s->value() / m_sum; data.m_angleSpan = pieSpan * data.m_percentage; data.m_startAngle = sliceAngle; sliceAngle += data.m_angleSpan; diff --git a/src/piechart/qpieseries.h b/src/piechart/qpieseries.h index 62c6d93..3d95193 100644 --- a/src/piechart/qpieseries.h +++ b/src/piechart/qpieseries.h @@ -59,7 +59,7 @@ public: // calculated data int count() const; bool isEmpty() const; - qreal total() const; + qreal sum() const; // pie customization void setHorizontalPosition(qreal relativePosition); diff --git a/src/piechart/qpieseries_p.h b/src/piechart/qpieseries_p.h index eb20108..66fc53d 100644 --- a/src/piechart/qpieseries_p.h +++ b/src/piechart/qpieseries_p.h @@ -55,7 +55,7 @@ public: qreal m_pieRelativeSize; qreal m_pieStartAngle; qreal m_pieEndAngle; - qreal m_total; + qreal m_sum; // model map int m_mapValues;