diff --git a/src/chartpresenter.cpp b/src/chartpresenter.cpp index 93d7e06..d58ed7a 100644 --- a/src/chartpresenter.cpp +++ b/src/chartpresenter.cpp @@ -20,7 +20,7 @@ #include "stackedbarpresenter_p.h" #include "percentbarpresenter_p.h" #include "linechartitem_p.h" -#include "piepresenter_p.h" +#include "piechartitem_p.h" #include "scatterchartitem_p.h" #include "splinechartitem_p.h" @@ -222,7 +222,7 @@ void ChartPresenter::handleSeriesAdded(QSeries* series,Domain* domain) case QSeries::SeriesTypePie: { QPieSeries *pieSeries = static_cast(series); - PiePresenter* pie = new PiePresenter(m_chart, pieSeries); + PieChartItem* pie = new PieChartItem(m_chart, pieSeries); if(m_options.testFlag(QChart::SeriesAnimations)) { // m_animator->addAnimation(pie); } diff --git a/src/charttheme.cpp b/src/charttheme.cpp index 4000688..c03ea9b 100644 --- a/src/charttheme.cpp +++ b/src/charttheme.cpp @@ -24,7 +24,7 @@ #include "linechartitem_p.h" #include "areachartitem_p.h" #include "scatterchartitem_p.h" -#include "piepresenter_p.h" +#include "piechartitem_p.h" #include "splinechartitem_p.h" //themes @@ -177,7 +177,7 @@ void ChartTheme::decorate(QScatterSeries* series, int index) } } -void ChartTheme::decorate(PiePresenter* item, QPieSeries* series, int index) +void ChartTheme::decorate(PieChartItem* item, QPieSeries* series, int index) { // Get color for a slice from a gradient linearly, beginning from the start of the gradient for (int i(0); i < series->slices().count(); i++) { diff --git a/src/charttheme_p.h b/src/charttheme_p.h index dc14627..89e465c 100644 --- a/src/charttheme_p.h +++ b/src/charttheme_p.h @@ -20,7 +20,7 @@ class QPercentBarSeries; class PercentBarPresenter; class QScatterSeries; class ScatterChartItem; -class PiePresenter; +class PieChartItem; class QPieSeries; class SplineChartItem; class QSplineSeries; @@ -51,7 +51,7 @@ public: void decorate(QLineSeries* series, int index); void decorate(QAreaSeries* series, int index); void decorate(QScatterSeries* series, int index); - void decorate(PiePresenter* item, QPieSeries* series, int index); + void decorate(PieChartItem* item, QPieSeries* series, int index); void decorate(QSplineSeries* series, int index); void decorate(QChartAxis* axis, bool axisX); diff --git a/src/piechart/piechart.pri b/src/piechart/piechart.pri index cb4b8b8..7ea1fb9 100644 --- a/src/piechart/piechart.pri +++ b/src/piechart/piechart.pri @@ -4,11 +4,11 @@ DEPENDPATH += $$PWD SOURCES += \ $$PWD/qpieseries.cpp \ $$PWD/pieslice.cpp \ - $$PWD/piepresenter.cpp \ + $$PWD/piechartitem.cpp \ $$PWD/qpieslice.cpp PRIVATE_HEADERS += \ - $$PWD/piepresenter_p.h \ + $$PWD/piechartitem_p.h \ $$PWD/pieslice_p.h \ PUBLIC_HEADERS += \ diff --git a/src/piechart/piepresenter.cpp b/src/piechart/piechartitem.cpp similarity index 90% rename from src/piechart/piepresenter.cpp rename to src/piechart/piechartitem.cpp index 2ebde05..1a51cc6 100644 --- a/src/piechart/piepresenter.cpp +++ b/src/piechart/piechartitem.cpp @@ -1,4 +1,4 @@ -#include "piepresenter_p.h" +#include "piechartitem_p.h" #include "pieslice_p.h" #include "qpieslice.h" #include "qpieseries.h" @@ -9,7 +9,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE -PiePresenter::PiePresenter(QGraphicsItem *parent, QPieSeries *series) +PieChartItem::PieChartItem(QGraphicsItem *parent, QPieSeries *series) :ChartItem(parent), m_series(series) { @@ -20,12 +20,12 @@ PiePresenter::PiePresenter(QGraphicsItem *parent, QPieSeries *series) setZValue(ChartPresenter::PieSeriesZValue); } -PiePresenter::~PiePresenter() +PieChartItem::~PieChartItem() { // slices deleted automatically through QGraphicsItem } -void PiePresenter::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) +void PieChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { // TODO: paint shadows for all components // - get paths from items & merge & offset and draw with shadow color? @@ -33,14 +33,14 @@ void PiePresenter::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QW //painter->drawRect(m_debugRect); } -void PiePresenter::handleSeriesChanged() +void PieChartItem::handleSeriesChanged() { QVector sliceLayout = calculateLayout(); applyLayout(sliceLayout); update(); } -void PiePresenter::handleSliceChanged() +void PieChartItem::handleSliceChanged() { // TODO: optimize don't need to handle all slices QVector sliceLayout = calculateLayout(); @@ -48,12 +48,12 @@ void PiePresenter::handleSliceChanged() update(); } -void PiePresenter::handleDomainChanged(qreal, qreal, qreal, qreal) +void PieChartItem::handleDomainChanged(qreal, qreal, qreal, qreal) { // TODO } -void PiePresenter::handleGeometryChanged(const QRectF& rect) +void PieChartItem::handleGeometryChanged(const QRectF& rect) { prepareGeometryChange(); m_rect = rect; @@ -63,7 +63,7 @@ void PiePresenter::handleGeometryChanged(const QRectF& rect) } -QVector PiePresenter::calculateLayout() +QVector PieChartItem::calculateLayout() { // find pie center coordinates QPointF center; @@ -92,7 +92,7 @@ QVector PiePresenter::calculateLayout() return layout; } -void PiePresenter::applyLayout(const QVector &layout) +void PieChartItem::applyLayout(const QVector &layout) { //if(m_animator) // m_animator->applyLayout(this,points); @@ -100,7 +100,7 @@ void PiePresenter::applyLayout(const QVector &layout) setLayout(layout); } -void PiePresenter::setLayout(const QVector &layout) +void PieChartItem::setLayout(const QVector &layout) { foreach (PieSliceLayout l, layout) { @@ -138,6 +138,6 @@ void PiePresenter::setLayout(const QVector &layout) } } -#include "moc_piepresenter_p.cpp" +#include "moc_piechartitem_p.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/piechart/piepresenter_p.h b/src/piechart/piechartitem_p.h similarity index 84% rename from src/piechart/piepresenter_p.h rename to src/piechart/piechartitem_p.h index 082544c..253348a 100644 --- a/src/piechart/piepresenter_p.h +++ b/src/piechart/piechartitem_p.h @@ -1,5 +1,5 @@ -#ifndef PIEPRESENTER_H -#define PIEPRESENTER_H +#ifndef PIECHARTITEM_H +#define PIECHARTITEM_H #include "qpieseries.h" #include "chartitem_p.h" @@ -9,14 +9,14 @@ class QGraphicsItem; QTCOMMERCIALCHART_BEGIN_NAMESPACE class QPieSlice; -class PiePresenter : public QObject, public ChartItem +class PieChartItem : public QObject, public ChartItem { Q_OBJECT public: // TODO: use a generic data class instead of x and y - PiePresenter(QGraphicsItem *parent, QPieSeries *series); - ~PiePresenter(); + PieChartItem(QGraphicsItem *parent, QPieSeries *series); + ~PieChartItem(); public: // from QGraphicsItem QRectF boundingRect() const { return m_rect; } @@ -45,4 +45,4 @@ private: QTCOMMERCIALCHART_END_NAMESPACE -#endif // PIEPRESENTER_H +#endif // PIECHARTITEM_H diff --git a/src/piechart/pieslice.cpp b/src/piechart/pieslice.cpp index 35b9577..fb55ef9 100644 --- a/src/piechart/pieslice.cpp +++ b/src/piechart/pieslice.cpp @@ -1,5 +1,5 @@ #include "pieslice_p.h" -#include "piepresenter_p.h" +#include "piechartitem_p.h" #include "qpieseries.h" #include "qpieslice.h" #include "chartpresenter_p.h" diff --git a/src/piechart/pieslice_p.h b/src/piechart/pieslice_p.h index 783e9ff..953ce35 100644 --- a/src/piechart/pieslice_p.h +++ b/src/piechart/pieslice_p.h @@ -12,7 +12,7 @@ #define PIESLICE_LABEL_GAP 5 QTCOMMERCIALCHART_BEGIN_NAMESPACE -class PiePresenter; +class PieChartItem; class PieSliceLabel; class QPieSlice; diff --git a/src/piechart/qpieseries.h b/src/piechart/qpieseries.h index 5bfb805..e5fe20e 100644 --- a/src/piechart/qpieseries.h +++ b/src/piechart/qpieseries.h @@ -11,7 +11,7 @@ class QGraphicsObject; QTCOMMERCIALCHART_BEGIN_NAMESPACE -class PiePresenter; +class PieChartItem; class PieSlice; class QPieSlice; @@ -112,7 +112,7 @@ private: Q_DISABLE_COPY(QPieSeries) // TODO: use PIML - friend class PiePresenter; + friend class PieChartItem; friend class PieSlice; QList m_slices; diff --git a/src/piechart/qpieslice.h b/src/piechart/qpieslice.h index 8df8670..abaf88c 100644 --- a/src/piechart/qpieslice.h +++ b/src/piechart/qpieslice.h @@ -63,7 +63,7 @@ private: // TODO: use private class friend class QPieSeries; - friend class PiePresenter; + friend class PieChartItem; friend class PieSlice; // data