From abacdc3682d169acb9baccfb2207c5d698e791ca 2012-02-20 12:11:13 From: sauimone Date: 2012-02-20 12:11:13 Subject: [PATCH] Common naming convention for barcharts --- diff --git a/example/barchart/main.cpp b/example/barchart/main.cpp index 4a82eeb..a450fa4 100644 --- a/example/barchart/main.cpp +++ b/example/barchart/main.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include #include "chartwidget.h" @@ -16,7 +16,7 @@ int main(int argc, char *argv[]) QBarCategory *category = new QBarCategory; *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec"; - BarChartSeries* series0 = new BarChartSeries(category); + QBarChartSeries* series0 = new QBarChartSeries(category); QBarSet *set0 = new QBarSet; QBarSet *set1 = new QBarSet; diff --git a/example/gdpbarchart/widget.cpp b/example/gdpbarchart/widget.cpp index ae1f98d..5c76875 100644 --- a/example/gdpbarchart/widget.cpp +++ b/example/gdpbarchart/widget.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include @@ -91,7 +91,7 @@ void Widget::refreshChart() QBarCategory* category = new QBarCategory; for (int i = 0; i < selectedCountriesStrings.size(); i++) *category << selectedCountriesStrings[i]; - BarChartSeries* series0 = new BarChartSeries(category); + QBarChartSeries* series0 = new QBarChartSeries(category); // prepare the selected counries SQL query QString countriesQuery = "country IN ("; diff --git a/example/percentbarchart/main.cpp b/example/percentbarchart/main.cpp index eb83064..d0d0394 100644 --- a/example/percentbarchart/main.cpp +++ b/example/percentbarchart/main.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include "chartwidget.h" #include #include @@ -16,7 +16,7 @@ int main(int argc, char *argv[]) QBarCategory *category = new QBarCategory; *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec"; - PercentBarChartSeries* series0 = new PercentBarChartSeries(category); + QPercentBarChartSeries* series0 = new QPercentBarChartSeries(category); QBarSet *set0 = new QBarSet; QBarSet *set1 = new QBarSet; diff --git a/example/stackedbarchart/main.cpp b/example/stackedbarchart/main.cpp index a03f154..c593b92 100644 --- a/example/stackedbarchart/main.cpp +++ b/example/stackedbarchart/main.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include "chartwidget.h" #include #include @@ -16,7 +16,7 @@ int main(int argc, char *argv[]) QBarCategory *category = new QBarCategory; *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec"; - StackedBarChartSeries* series0 = new StackedBarChartSeries(category); + QStackedBarChartSeries* series0 = new QStackedBarChartSeries(category); QBarSet *set0 = new QBarSet; QBarSet *set1 = new QBarSet; diff --git a/src/barchart/bargroup.cpp b/src/barchart/barpresenter.cpp similarity index 93% rename from src/barchart/bargroup.cpp rename to src/barchart/barpresenter.cpp index 5db14da..f23f4fb 100644 --- a/src/barchart/bargroup.cpp +++ b/src/barchart/barpresenter.cpp @@ -1,4 +1,4 @@ -#include "bargroup.h" +#include "barpresenter.h" #include "bar_p.h" #include "barlabel_p.h" #include "qbarset.h" @@ -6,13 +6,13 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE -BarGroup::BarGroup(BarChartModel& model, QGraphicsItem *parent) : - BarGroupBase(model,parent) +BarPresenter::BarPresenter(BarChartModel& model, QGraphicsItem *parent) : + BarPresenterBase(model,parent) { mBarDefaultWidth = 5; } -void BarGroup::layoutChanged() +void BarPresenter::layoutChanged() { // qDebug() << "BarGroup::layoutChanged"; // Scale bars to new layout diff --git a/src/barchart/bargroup.h b/src/barchart/barpresenter.h similarity index 78% rename from src/barchart/bargroup.h rename to src/barchart/barpresenter.h index 5aeebfc..77e2f96 100644 --- a/src/barchart/bargroup.h +++ b/src/barchart/barpresenter.h @@ -1,18 +1,18 @@ #ifndef QBARGROUP_H #define QBARGROUP_H -#include "bargroupbase.h" -#include "barchartseries.h" +#include "barpresenterbase.h" +#include "qbarchartseries.h" #include QTCOMMERCIALCHART_BEGIN_NAMESPACE // Base class for bar groups -class BarGroup : public BarGroupBase +class BarPresenter : public BarPresenterBase { public: - explicit BarGroup(BarChartModel& model, QGraphicsItem *parent = 0); + explicit BarPresenter(BarChartModel& model, QGraphicsItem *parent = 0); private: diff --git a/src/barchart/bargroupbase.cpp b/src/barchart/barpresenterbase.cpp similarity index 88% rename from src/barchart/bargroupbase.cpp rename to src/barchart/barpresenterbase.cpp index 233a84f..4c96686 100644 --- a/src/barchart/bargroupbase.cpp +++ b/src/barchart/barpresenterbase.cpp @@ -1,4 +1,4 @@ -#include "bargroupbase.h" +#include "barpresenterbase.h" #include "bar_p.h" #include "barlabel_p.h" #include "separator_p.h" @@ -6,7 +6,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE -BarGroupBase::BarGroupBase(BarChartModel& model, QGraphicsItem *parent) +BarPresenterBase::BarPresenterBase(BarChartModel& model, QGraphicsItem *parent) : ChartItem(parent) ,mBarDefaultWidth(20) // TODO: remove hard coding, when we have layout code ready ,mLayoutSet(false) @@ -17,12 +17,12 @@ BarGroupBase::BarGroupBase(BarChartModel& model, QGraphicsItem *parent) dataChanged(); } -void BarGroupBase::setSeparatorsVisible(bool visible) +void BarPresenterBase::setSeparatorsVisible(bool visible) { mSeparatorsVisible = visible; } -void BarGroupBase::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +void BarPresenterBase::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { // qDebug() << "BarGroupBase::paint" << childItems().count(); if (!mLayoutSet) { @@ -37,12 +37,12 @@ void BarGroupBase::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti // } } -QRectF BarGroupBase::boundingRect() const +QRectF BarPresenterBase::boundingRect() const { return QRectF(0,0,mWidth,mHeight); } -void BarGroupBase::setBarWidth( int w ) +void BarPresenterBase::setBarWidth( int w ) { mBarDefaultWidth = w; } @@ -57,7 +57,7 @@ void BarGroupBase::addBrush(QBrush brush) mBrushes.append(brush); } */ -void BarGroupBase::dataChanged() +void BarPresenterBase::dataChanged() { // TODO: performance optimizations. Do we really need to delete and create items every time data is changed or can we reuse them? @@ -93,13 +93,13 @@ void BarGroupBase::dataChanged() //handlers -void BarGroupBase::handleModelChanged(int index) +void BarPresenterBase::handleModelChanged(int index) { // qDebug() << "BarGroupBase::handleModelChanged" << index; dataChanged(); } -void BarGroupBase::handleDomainChanged(const Domain& domain) +void BarPresenterBase::handleDomainChanged(const Domain& domain) { // qDebug() << "BarGroupBase::handleDomainChanged"; // TODO: Figure out the use case for this. @@ -107,7 +107,7 @@ void BarGroupBase::handleDomainChanged(const Domain& domain) // layoutChanged(); } -void BarGroupBase::handleGeometryChanged(const QRectF& rect) +void BarPresenterBase::handleGeometryChanged(const QRectF& rect) { mWidth = rect.width(); mHeight = rect.height(); @@ -116,6 +116,6 @@ void BarGroupBase::handleGeometryChanged(const QRectF& rect) setPos(rect.topLeft()); } -#include "moc_bargroupbase.cpp" +#include "moc_barpresenterbase.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/bargroupbase.h b/src/barchart/barpresenterbase.h similarity index 96% rename from src/barchart/bargroupbase.h rename to src/barchart/barpresenterbase.h index 67dfe40..18828b6 100644 --- a/src/barchart/bargroupbase.h +++ b/src/barchart/barpresenterbase.h @@ -10,11 +10,11 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE // Base Class for bar groups. Common implemantation of different groups. Not to be instantiated. -class BarGroupBase : public QObject, public ChartItem +class BarPresenterBase : public QObject, public ChartItem { Q_OBJECT public: - BarGroupBase(BarChartModel& model, QGraphicsItem *parent = 0); + BarPresenterBase(BarChartModel& model, QGraphicsItem *parent = 0); void setSeparatorsVisible(bool visible = true); public: diff --git a/src/barchart/percentbargroup.cpp b/src/barchart/percentbarpresenter.cpp similarity index 93% rename from src/barchart/percentbargroup.cpp rename to src/barchart/percentbarpresenter.cpp index a875b27..20431d4 100644 --- a/src/barchart/percentbargroup.cpp +++ b/src/barchart/percentbarpresenter.cpp @@ -1,4 +1,4 @@ -#include "percentbargroup.h" +#include "percentbarpresenter.h" #include "bar_p.h" #include "barlabel_p.h" #include "separator_p.h" @@ -8,12 +8,12 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE -PercentBarGroup::PercentBarGroup(BarChartModel& model, QGraphicsItem *parent) : - BarGroupBase(model, parent) +PercentBarPresenter::PercentBarPresenter(BarChartModel& model, QGraphicsItem *parent) : + BarPresenterBase(model, parent) { } -void PercentBarGroup::layoutChanged() +void PercentBarPresenter::layoutChanged() { // qDebug() << "PercentBarGroup::layoutChanged"; // Scale bars to new layout diff --git a/src/barchart/percentbargroup.h b/src/barchart/percentbarpresenter.h similarity index 78% rename from src/barchart/percentbargroup.h rename to src/barchart/percentbarpresenter.h index 5063f2c..040e53a 100644 --- a/src/barchart/percentbargroup.h +++ b/src/barchart/percentbarpresenter.h @@ -3,16 +3,16 @@ #include "chartitem_p.h" #include "bar_p.h" -#include "percentbarchartseries.h" -#include "bargroupbase.h" +#include "qpercentbarchartseries.h" +#include "barpresenterbase.h" #include QTCOMMERCIALCHART_BEGIN_NAMESPACE -class PercentBarGroup : public BarGroupBase +class PercentBarPresenter : public BarPresenterBase { public: - PercentBarGroup(BarChartModel& model, QGraphicsItem *parent = 0); + PercentBarPresenter(BarChartModel& model, QGraphicsItem *parent = 0); private: diff --git a/src/barchart/barchartseries.cpp b/src/barchart/qbarchartseries.cpp similarity index 75% rename from src/barchart/barchartseries.cpp rename to src/barchart/qbarchartseries.cpp index 8bb6f16..1506e63 100644 --- a/src/barchart/barchartseries.cpp +++ b/src/barchart/qbarchartseries.cpp @@ -1,5 +1,5 @@ #include -#include "barchartseries.h" +#include "qbarchartseries.h" #include "qbarcategory.h" #include "qbarset.h" #include "barchartmodel_p.h" @@ -7,63 +7,63 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE -BarChartSeries::BarChartSeries(QBarCategory *category, QObject *parent) +QBarChartSeries::QBarChartSeries(QBarCategory *category, QObject *parent) : QChartSeries(parent) ,mModel(new BarChartModel(category, this)) { } -void BarChartSeries::addBarSet(QBarSet *set) +void QBarChartSeries::addBarSet(QBarSet *set) { mModel->addBarSet(set); } -void BarChartSeries::removeBarSet(QBarSet *set) +void QBarChartSeries::removeBarSet(QBarSet *set) { mModel->removeBarSet(set); } -int BarChartSeries::countSets() +int QBarChartSeries::countSets() { return mModel->countSets(); } -QBarSet* BarChartSeries::nextSet(bool getFirst) +QBarSet* QBarChartSeries::nextSet(bool getFirst) { return mModel->nextSet(getFirst); } -int BarChartSeries::countCategories() +int QBarChartSeries::countCategories() { return mModel->countCategories(); } -qreal BarChartSeries::min() +qreal QBarChartSeries::min() { return mModel->min(); } -qreal BarChartSeries::max() +qreal QBarChartSeries::max() { return mModel->max(); } -qreal BarChartSeries::valueAt(int set, int category) +qreal QBarChartSeries::valueAt(int set, int category) { return mModel->valueAt(set,category); } -qreal BarChartSeries::maxCategorySum() +qreal QBarChartSeries::maxCategorySum() { return mModel->maxCategorySum(); } -BarChartModel& BarChartSeries::model() +BarChartModel& QBarChartSeries::model() { return *mModel; } -#include "moc_barchartseries.cpp" +#include "moc_qbarchartseries.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/barchartseries.h b/src/barchart/qbarchartseries.h similarity index 90% rename from src/barchart/barchartseries.h rename to src/barchart/qbarchartseries.h index c8a3c15..ebd19bd 100644 --- a/src/barchart/barchartseries.h +++ b/src/barchart/qbarchartseries.h @@ -9,15 +9,15 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE class QBarCategory; class QBarSet; -class BarGroup; +class BarPresenter; class BarChartModel; // Container for series -class QTCOMMERCIALCHART_EXPORT BarChartSeries : public QChartSeries +class QTCOMMERCIALCHART_EXPORT QBarChartSeries : public QChartSeries { Q_OBJECT public: - BarChartSeries(QBarCategory *category, QObject* parent=0); + QBarChartSeries(QBarCategory *category, QObject* parent=0); virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeBar; } @@ -46,7 +46,7 @@ public Q_SLOTS: private: - BarGroup* mBarGroup; + BarPresenter* mBarGroup; BarChartModel* mModel; }; diff --git a/src/barchart/stackedbarchartseries.cpp b/src/barchart/qpercentbarchartseries.cpp similarity index 74% rename from src/barchart/stackedbarchartseries.cpp rename to src/barchart/qpercentbarchartseries.cpp index 8093d24..271197b 100644 --- a/src/barchart/stackedbarchartseries.cpp +++ b/src/barchart/qpercentbarchartseries.cpp @@ -1,70 +1,70 @@ #include #include -#include "stackedbarchartseries.h" -#include "qbarcategory.h" +#include "qpercentbarchartseries.h" #include "qbarset.h" +#include "qbarcategory.h" #include "barchartmodel_p.h" QTCOMMERCIALCHART_BEGIN_NAMESPACE -StackedBarChartSeries::StackedBarChartSeries(QBarCategory *category, QObject *parent) +QPercentBarChartSeries::QPercentBarChartSeries(QBarCategory *category, QObject *parent) : QChartSeries(parent) ,mModel(new BarChartModel(category, this)) { } -void StackedBarChartSeries::addBarSet(QBarSet *set) +void QPercentBarChartSeries::addBarSet(QBarSet *set) { mModel->addBarSet(set); } -void StackedBarChartSeries::removeBarSet(QBarSet *set) +void QPercentBarChartSeries::removeBarSet(QBarSet *set) { mModel->removeBarSet(set); } -int StackedBarChartSeries::countSets() +int QPercentBarChartSeries::countSets() { return mModel->countSets(); } -QBarSet* StackedBarChartSeries::nextSet(bool getFirst) +QBarSet* QPercentBarChartSeries::nextSet(bool getFirst) { return mModel->nextSet(getFirst); } -int StackedBarChartSeries::countCategories() +int QPercentBarChartSeries::countCategories() { return mModel->countCategories(); } -qreal StackedBarChartSeries::min() +qreal QPercentBarChartSeries::min() { return mModel->min(); } -qreal StackedBarChartSeries::max() +qreal QPercentBarChartSeries::max() { return mModel->max(); } -qreal StackedBarChartSeries::valueAt(int set, int category) +qreal QPercentBarChartSeries::valueAt(int set, int category) { return mModel->valueAt(set,category); } -qreal StackedBarChartSeries::maxCategorySum() +qreal QPercentBarChartSeries::maxCategorySum() { return mModel->maxCategorySum(); } -BarChartModel& StackedBarChartSeries::model() +BarChartModel& QPercentBarChartSeries::model() { return *mModel; } -#include "moc_stackedbarchartseries.cpp" +#include "moc_qpercentbarchartseries.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/percentbarchartseries.h b/src/barchart/qpercentbarchartseries.h similarity index 90% rename from src/barchart/percentbarchartseries.h rename to src/barchart/qpercentbarchartseries.h index b583db3..52c14fa 100644 --- a/src/barchart/percentbarchartseries.h +++ b/src/barchart/qpercentbarchartseries.h @@ -7,16 +7,16 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE -class PercentBarGroup; +class PercentBarPresenter; class QBarCategory; class QBarSet; class BarChartModel; -class QTCOMMERCIALCHART_EXPORT PercentBarChartSeries : public QChartSeries +class QTCOMMERCIALCHART_EXPORT QPercentBarChartSeries : public QChartSeries { Q_OBJECT public: - PercentBarChartSeries(QBarCategory *category, QObject* parent=0); + QPercentBarChartSeries(QBarCategory *category, QObject* parent=0); // from BarChartSeriesBase virtual QChartSeriesType type() const { return QChartSeries::SeriesTypePercentBar; } @@ -47,7 +47,7 @@ public Q_SLOTS: private: - PercentBarGroup* mPercentBarGroup; + PercentBarPresenter* mPercentBarGroup; BarChartModel* mModel; }; diff --git a/src/barchart/percentbarchartseries.cpp b/src/barchart/qstackedbarchartseries.cpp similarity index 73% rename from src/barchart/percentbarchartseries.cpp rename to src/barchart/qstackedbarchartseries.cpp index 66ba990..219b69d 100644 --- a/src/barchart/percentbarchartseries.cpp +++ b/src/barchart/qstackedbarchartseries.cpp @@ -1,72 +1,70 @@ -#include "percentbarchartseries.h" - #include #include -#include "percentbarchartseries.h" -#include "qbarset.h" +#include "qstackedbarchartseries.h" #include "qbarcategory.h" +#include "qbarset.h" #include "barchartmodel_p.h" QTCOMMERCIALCHART_BEGIN_NAMESPACE -PercentBarChartSeries::PercentBarChartSeries(QBarCategory *category, QObject *parent) +QStackedBarChartSeries::QStackedBarChartSeries(QBarCategory *category, QObject *parent) : QChartSeries(parent) ,mModel(new BarChartModel(category, this)) { } -void PercentBarChartSeries::addBarSet(QBarSet *set) +void QStackedBarChartSeries::addBarSet(QBarSet *set) { mModel->addBarSet(set); } -void PercentBarChartSeries::removeBarSet(QBarSet *set) +void QStackedBarChartSeries::removeBarSet(QBarSet *set) { mModel->removeBarSet(set); } -int PercentBarChartSeries::countSets() +int QStackedBarChartSeries::countSets() { return mModel->countSets(); } -QBarSet* PercentBarChartSeries::nextSet(bool getFirst) +QBarSet* QStackedBarChartSeries::nextSet(bool getFirst) { return mModel->nextSet(getFirst); } -int PercentBarChartSeries::countCategories() +int QStackedBarChartSeries::countCategories() { return mModel->countCategories(); } -qreal PercentBarChartSeries::min() +qreal QStackedBarChartSeries::min() { return mModel->min(); } -qreal PercentBarChartSeries::max() +qreal QStackedBarChartSeries::max() { return mModel->max(); } -qreal PercentBarChartSeries::valueAt(int set, int category) +qreal QStackedBarChartSeries::valueAt(int set, int category) { return mModel->valueAt(set,category); } -qreal PercentBarChartSeries::maxCategorySum() +qreal QStackedBarChartSeries::maxCategorySum() { return mModel->maxCategorySum(); } -BarChartModel& PercentBarChartSeries::model() +BarChartModel& QStackedBarChartSeries::model() { return *mModel; } -#include "moc_percentbarchartseries.cpp" +#include "moc_qstackedbarchartseries.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/stackedbarchartseries.h b/src/barchart/qstackedbarchartseries.h similarity index 90% rename from src/barchart/stackedbarchartseries.h rename to src/barchart/qstackedbarchartseries.h index a428071..823b3b4 100644 --- a/src/barchart/stackedbarchartseries.h +++ b/src/barchart/qstackedbarchartseries.h @@ -7,16 +7,16 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE -class StackedBarGroup; +class StackedBarPresenter; class QBarCategory; class QBarSet; class BarChartModel; -class QTCOMMERCIALCHART_EXPORT StackedBarChartSeries : public QChartSeries +class QTCOMMERCIALCHART_EXPORT QStackedBarChartSeries : public QChartSeries { Q_OBJECT public: - StackedBarChartSeries(QBarCategory *category, QObject* parent=0); + QStackedBarChartSeries(QBarCategory *category, QObject* parent=0); // from QChartSeries virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeStackedBar; } @@ -46,7 +46,7 @@ public Q_SLOTS: private: - StackedBarGroup* mStackedBarGroup; + StackedBarPresenter* mStackedBarGroup; BarChartModel* mModel; }; diff --git a/src/barchart/stackedbargroup.cpp b/src/barchart/stackedbarpresenter.cpp similarity index 94% rename from src/barchart/stackedbargroup.cpp rename to src/barchart/stackedbarpresenter.cpp index aaa668f..74fdcdc 100644 --- a/src/barchart/stackedbargroup.cpp +++ b/src/barchart/stackedbarpresenter.cpp @@ -1,4 +1,4 @@ -#include "stackedbargroup.h" +#include "stackedbarpresenter.h" #include "bar_p.h" #include "barlabel_p.h" #include "separator_p.h" @@ -7,12 +7,12 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE -StackedBarGroup::StackedBarGroup(BarChartModel& model, QGraphicsItem *parent) : - BarGroupBase(model,parent) +StackedBarPresenter::StackedBarPresenter(BarChartModel& model, QGraphicsItem *parent) : + BarPresenterBase(model,parent) { } -void StackedBarGroup::layoutChanged() +void StackedBarPresenter::layoutChanged() { // qDebug() << "StackedBarGroup::layoutChanged"; // Scale bars to new layout diff --git a/src/barchart/stackedbargroup.h b/src/barchart/stackedbarpresenter.h similarity index 77% rename from src/barchart/stackedbargroup.h rename to src/barchart/stackedbarpresenter.h index bd52be2..fc79acc 100644 --- a/src/barchart/stackedbargroup.h +++ b/src/barchart/stackedbarpresenter.h @@ -1,16 +1,16 @@ #ifndef STACKEDBARGROUP_H #define STACKEDBARGROUP_H -#include "bargroupbase.h" -#include "stackedbarchartseries.h" +#include "barpresenterbase.h" +#include "qstackedbarchartseries.h" #include QTCOMMERCIALCHART_BEGIN_NAMESPACE -class StackedBarGroup : public BarGroupBase +class StackedBarPresenter : public BarPresenterBase { public: - StackedBarGroup(BarChartModel& model, QGraphicsItem *parent = 0); + StackedBarPresenter(BarChartModel& model, QGraphicsItem *parent = 0); private: // From BarGroupBase diff --git a/src/chartdataset.cpp b/src/chartdataset.cpp index af0ae36..8cdce58 100644 --- a/src/chartdataset.cpp +++ b/src/chartdataset.cpp @@ -1,9 +1,9 @@ #include "chartdataset_p.h" //series #include "qlinechartseries.h" -#include "barchartseries.h" -#include "stackedbarchartseries.h" -#include "percentbarchartseries.h" +#include "qbarchartseries.h" +#include "qstackedbarchartseries.h" +#include "qpercentbarchartseries.h" #include "qpieseries.h" #include "qscatterseries.h" @@ -54,7 +54,7 @@ void ChartDataSet::addSeries(QChartSeries* series) } case QChartSeries::SeriesTypeBar: { qDebug() << "QChartSeries::SeriesTypeBar"; - BarChartSeries* barSeries = static_cast(series); + QBarChartSeries* barSeries = static_cast(series); qreal x = barSeries->countCategories(); qreal y = barSeries->max(); domain.m_minX = qMin(domain.m_minX,x); @@ -66,7 +66,7 @@ void ChartDataSet::addSeries(QChartSeries* series) case QChartSeries::SeriesTypeStackedBar: { qDebug() << "QChartSeries::SeriesTypeStackedBar"; - StackedBarChartSeries* stackedBarSeries = static_cast(series); + QStackedBarChartSeries* stackedBarSeries = static_cast(series); qreal x = stackedBarSeries->countCategories(); qreal y = stackedBarSeries->maxCategorySum(); domain.m_minX = qMin(domain.m_minX,x); @@ -78,7 +78,7 @@ void ChartDataSet::addSeries(QChartSeries* series) case QChartSeries::SeriesTypePercentBar: { qDebug() << "QChartSeries::SeriesTypePercentBar"; - PercentBarChartSeries* percentBarSeries = static_cast(series); + QPercentBarChartSeries* percentBarSeries = static_cast(series); qreal x = percentBarSeries->countCategories(); domain.m_minX = qMin(domain.m_minX,x); domain.m_minY = 0; diff --git a/src/chartpresenter.cpp b/src/chartpresenter.cpp index 07463b1..6969772 100644 --- a/src/chartpresenter.cpp +++ b/src/chartpresenter.cpp @@ -4,18 +4,18 @@ #include "chartdataset_p.h" #include "charttheme_p.h" //series -#include "barchartseries.h" -#include "stackedbarchartseries.h" -#include "percentbarchartseries.h" +#include "qbarchartseries.h" +#include "qstackedbarchartseries.h" +#include "qpercentbarchartseries.h" #include "qlinechartseries.h" #include "qpieseries.h" #include "qscatterseries.h" //items #include "axisitem_p.h" -#include "bargroup.h" -#include "stackedbargroup.h" +#include "barpresenter.h" +#include "stackedbarpresenter.h" #include "linechartitem_p.h" -#include "percentbargroup.h" +#include "percentbarpresenter.h" #include "linechartanimationitem_p.h" #include "piepresenter.h" #include "scatterpresenter_p.h" @@ -85,8 +85,8 @@ void ChartPresenter::handleSeriesAdded(QChartSeries* series) } case QChartSeries::SeriesTypeBar: { - BarChartSeries* barSeries = static_cast(series); - BarGroup* item = new BarGroup(barSeries->model(),m_chart); + QBarChartSeries* barSeries = static_cast(series); + BarPresenter* item = new BarPresenter(barSeries->model(),m_chart); m_chartTheme->decorate(item,barSeries,m_chartItems.count()); QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); QObject::connect(m_dataset,SIGNAL(domainChanged(const Domain&)),item,SLOT(handleDomainChanged(const Domain&))); @@ -98,8 +98,8 @@ void ChartPresenter::handleSeriesAdded(QChartSeries* series) case QChartSeries::SeriesTypeStackedBar: { - StackedBarChartSeries* stackedBarSeries = static_cast(series); - StackedBarGroup* item = new StackedBarGroup(stackedBarSeries->model(),m_chart); + QStackedBarChartSeries* stackedBarSeries = static_cast(series); + StackedBarPresenter* item = new StackedBarPresenter(stackedBarSeries->model(),m_chart); m_chartTheme->decorate(item,stackedBarSeries,m_chartItems.count()); QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); QObject::connect(m_dataset,SIGNAL(domainChanged(const Domain&)),item,SLOT(handleDomainChanged(const Domain&))); @@ -110,8 +110,8 @@ void ChartPresenter::handleSeriesAdded(QChartSeries* series) case QChartSeries::SeriesTypePercentBar: { - PercentBarChartSeries* percentBarSeries = static_cast(series); - PercentBarGroup* item = new PercentBarGroup(percentBarSeries->model(),m_chart); + QPercentBarChartSeries* percentBarSeries = static_cast(series); + PercentBarPresenter* item = new PercentBarPresenter(percentBarSeries->model(),m_chart); m_chartTheme->decorate(item,percentBarSeries ,m_chartItems.count()); QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); QObject::connect(m_dataset,SIGNAL(domainChanged(const Domain&)),item,SLOT(handleDomainChanged(const Domain&))); diff --git a/src/charttheme.cpp b/src/charttheme.cpp index da6dc3a..243f84b 100644 --- a/src/charttheme.cpp +++ b/src/charttheme.cpp @@ -5,9 +5,9 @@ //series #include "qbarset.h" -#include "barchartseries.h" -#include "stackedbarchartseries.h" -#include "percentbarchartseries.h" +#include "qbarchartseries.h" +#include "qstackedbarchartseries.h" +#include "qpercentbarchartseries.h" #include "qlinechartseries.h" #include "qscatterseries.h" #include "qpieseries.h" @@ -15,10 +15,10 @@ //items #include "axisitem_p.h" -#include "bargroup.h" -#include "stackedbargroup.h" +#include "barpresenter.h" +#include "stackedbarpresenter.h" #include "linechartitem_p.h" -#include "percentbargroup.h" +#include "percentbarpresenter.h" #include "scatterpresenter_p.h" #include "piepresenter.h" @@ -89,20 +89,20 @@ void ChartTheme::decorate(ChartItem* item, QChartSeries* series,int count) break; } case QChartSeries::SeriesTypeBar: { - BarChartSeries* b = static_cast(series); - BarGroup* i = static_cast(item); + QBarChartSeries* b = static_cast(series); + BarPresenter* i = static_cast(item); decorate(i,b,count); break; } case QChartSeries::SeriesTypeStackedBar: { - StackedBarChartSeries* s = static_cast(series); - StackedBarGroup* i = static_cast(item); + QStackedBarChartSeries* s = static_cast(series); + StackedBarPresenter* i = static_cast(item); decorate(i,s,count); break; } case QChartSeries::SeriesTypePercentBar: { - PercentBarChartSeries* s = static_cast(series); - PercentBarGroup* i = static_cast(item); + QPercentBarChartSeries* s = static_cast(series); + PercentBarPresenter* i = static_cast(item); decorate(i,s,count); break; } @@ -139,21 +139,21 @@ void ChartTheme::decorate(LineChartItem* item, QLineChartSeries* series,int coun item->setPen(pen); } -void ChartTheme::decorate(BarGroup* item, BarChartSeries* series,int count) +void ChartTheme::decorate(BarPresenter* item, QBarChartSeries* series,int count) { for (int i=0; icountSets(); i++) { series->nextSet(0==i)->setBrush(QBrush(m_seriesColor.at(i%m_seriesColor.count()))); } } -void ChartTheme::decorate(StackedBarGroup* item, StackedBarChartSeries* series,int count) +void ChartTheme::decorate(StackedBarPresenter* item, QStackedBarChartSeries* series,int count) { for (int i=0; icountSets(); i++) { series->nextSet(0==i)->setBrush(QBrush(m_seriesColor.at(i%m_seriesColor.count()))); } } -void ChartTheme::decorate(PercentBarGroup* item, PercentBarChartSeries* series,int count) +void ChartTheme::decorate(PercentBarPresenter* item, QPercentBarChartSeries* series,int count) { for (int i=0; icountSets(); i++) { series->nextSet(0==i)->setBrush(QBrush(m_seriesColor.at(i%m_seriesColor.count()))); diff --git a/src/charttheme_p.h b/src/charttheme_p.h index 0d76fa0..90aad26 100644 --- a/src/charttheme_p.h +++ b/src/charttheme_p.h @@ -11,12 +11,12 @@ class ChartItem; class QChartSeries; class LineChartItem; class QLineChartSeries; -class BarGroup; -class BarChartSeries; -class StackedBarGroup; -class StackedBarChartSeries; -class PercentBarChartSeries; -class PercentBarGroup; +class BarPresenter; +class QBarChartSeries; +class StackedBarPresenter; +class QStackedBarChartSeries; +class QPercentBarChartSeries; +class PercentBarPresenter; class QScatterSeries; class ScatterPresenter; class PiePresenter; @@ -32,9 +32,9 @@ public: void decorate(QChart* chart); void decorate(ChartItem* item, QChartSeries* series,int count); void decorate(LineChartItem* item, QLineChartSeries*, int count); - void decorate(BarGroup* item, BarChartSeries* series,int count); - void decorate(StackedBarGroup* item, StackedBarChartSeries* series,int count); - void decorate(PercentBarGroup* item, PercentBarChartSeries* series,int count); + void decorate(BarPresenter* item, QBarChartSeries* series,int count); + void decorate(StackedBarPresenter* item, QStackedBarChartSeries* series,int count); + void decorate(PercentBarPresenter* item, QPercentBarChartSeries* series,int count); void decorate(ScatterPresenter* presenter, QScatterSeries* series, int count); void decorate(PiePresenter* item, QPieSeries* series, int count); void decorate(QChartAxis& axis,AxisItem* item); diff --git a/src/qchart.cpp b/src/qchart.cpp index 2168467..49afbce 100644 --- a/src/qchart.cpp +++ b/src/qchart.cpp @@ -4,9 +4,9 @@ #include "chartdataset_p.h" //series -#include "barchartseries.h" -#include "stackedbarchartseries.h" -#include "percentbarchartseries.h" +#include "qbarchartseries.h" +#include "qstackedbarchartseries.h" +#include "qpercentbarchartseries.h" #include "qlinechartseries.h" #include "qscatterseries.h" //#include "scatterseries_p.h" diff --git a/src/qchart.h b/src/qchart.h index bba1092..5c551dc 100644 --- a/src/qchart.h +++ b/src/qchart.h @@ -14,7 +14,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE class AxisItem; class QChartSeries; class PlotDomain; -class BarGroup; +class BarPresenter; class QChartAxis; class ChartTheme; class ChartItem; diff --git a/src/src.pro b/src/src.pro index ffac271..da952a2 100644 --- a/src/src.pro +++ b/src/src.pro @@ -6,19 +6,20 @@ QT += core \ gui CONFIG += debug_and_release CONFIG(debug, debug|release):TARGET = QtCommercialChartd -SOURCES += barchart/barchartseries.cpp \ - barchart/bargroup.cpp \ +SOURCES += \ barchart/bar.cpp \ - barchart/stackedbarchartseries.cpp \ - barchart/stackedbargroup.cpp \ - barchart/percentbarchartseries.cpp \ - barchart/percentbargroup.cpp \ barchart/barlabel.cpp \ barchart/barchartmodel.cpp \ barchart/separator.cpp \ - barchart/bargroupbase.cpp \ barchart/qbarset.cpp \ barchart/qbarcategory.cpp \ + barchart/qbarchartseries.cpp \ + barchart/qpercentbarchartseries.cpp \ + barchart/qstackedbarchartseries.cpp \ + barchart/barpresenterbase.cpp \ + barchart/barpresenter.cpp \ + barchart/stackedbarpresenter.cpp \ + barchart/percentbarpresenter.cpp \ linechart/linechartanimationitem.cpp \ linechart/linechartitem.cpp \ linechart/qlinechartseries.cpp \ @@ -44,13 +45,13 @@ PRIVATE_HEADERS += linechart/linechartitem_p.h \ chartpresenter_p.h \ domain_p.h PUBLIC_HEADERS += linechart/qlinechartseries.h \ - barchart/barchartseries.h \ - barchart/bargroup.h \ - barchart/stackedbarchartseries.h \ - barchart/stackedbargroup.h \ - barchart/percentbarchartseries.h \ - barchart/percentbargroup.h \ - barchart/bargroupbase.h \ + barchart/qbarchartseries.h \ + barchart/barpresenter.h \ + barchart/qstackedbarchartseries.h \ + barchart/stackedbarpresenter.h \ + barchart/qpercentbarchartseries.h \ + barchart/percentbarpresenter.h \ + barchart/barpresenterbase.h \ barchart/qbarset.h \ barchart/qbarcategory.h \ qchartseries.h \ diff --git a/test/chartwidgettest/mainwidget.cpp b/test/chartwidgettest/mainwidget.cpp index e5fbeee..8d1dbcf 100644 --- a/test/chartwidgettest/mainwidget.cpp +++ b/test/chartwidgettest/mainwidget.cpp @@ -6,9 +6,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include