From a9fe09868de948d3a028f8b050b80aa8fe581b84 2012-07-17 09:40:05 From: Michal Klocek Date: 2012-07-17 09:40:05 Subject: [PATCH] Refactor barchart * Move implmentation to specific directories * Implement axis intialization and default only in base class since code is very trival --- diff --git a/src/barchart/barchart.pri b/src/barchart/barchart.pri index 9f9ae39..3cd148c 100644 --- a/src/barchart/barchart.pri +++ b/src/barchart/barchart.pri @@ -1,55 +1,28 @@ +include(vertical/vertical.pri) +include(horizontal/horizontal.pri) + INCLUDEPATH += $$PWD DEPENDPATH += $$PWD SOURCES += \ $$PWD/bar.cpp \ $$PWD/abstractbarchartitem.cpp \ - $$PWD/percentbarchartitem.cpp \ - $$PWD/barchartitem.cpp \ $$PWD/qabstractbarseries.cpp \ $$PWD/qbarset.cpp \ - $$PWD/qpercentbarseries.cpp \ - $$PWD/qstackedbarseries.cpp \ - $$PWD/qbarseries.cpp \ - $$PWD/stackedbarchartitem.cpp \ $$PWD/qbarmodelmapper.cpp \ $$PWD/qvbarmodelmapper.cpp \ $$PWD/qhbarmodelmapper.cpp \ - $$PWD/qhorizontalbarseries.cpp \ - $$PWD/horizontalbarchartitem.cpp \ - $$PWD/qhorizontalstackedbarseries.cpp \ - $$PWD/horizontalstackedbarchartitem.cpp \ - $$PWD/qhorizontalpercentbarseries.cpp \ - $$PWD/horizontalpercentbarchartitem.cpp PRIVATE_HEADERS += \ $$PWD/bar_p.h \ - $$PWD/abstractbarchartitem_p.h \ - $$PWD/percentbarchartitem_p.h \ - $$PWD/stackedbarchartitem_p.h \ - $$PWD/barchartitem_p.h \ $$PWD/qbarset_p.h \ + $$PWD/abstractbarchartitem_p.h \ $$PWD/qabstractbarseries_p.h \ - $$PWD/qstackedbarseries_p.h\ - $$PWD/qpercentbarseries_p.h \ - $$PWD/qbarseries_p.h \ - $$PWD/qbarmodelmapper_p.h \ - $$PWD/qhorizontalbarseries_p.h \ - $$PWD/horizontalbarchartitem_p.h \ - $$PWD/qhorizontalstackedbarseries_p.h \ - $$PWD/horizontalstackedbarchartitem_p.h \ - $$PWD/qhorizontalpercentbarseries_p.h \ - $$PWD/horizontalpercentbarchartitem_p.h + $$PWD/qbarmodelmapper_p.h PUBLIC_HEADERS += \ $$PWD/qabstractbarseries.h \ $$PWD/qbarset.h \ - $$PWD/qpercentbarseries.h \ - $$PWD/qstackedbarseries.h \ - $$PWD/qbarseries.h \ $$PWD/qbarmodelmapper.h \ $$PWD/qvbarmodelmapper.h \ - $$PWD/qhbarmodelmapper.h \ - $$PWD/qhorizontalbarseries.h \ - $$PWD/qhorizontalstackedbarseries.h \ - $$PWD/qhorizontalpercentbarseries.h + $$PWD/qhbarmodelmapper.h diff --git a/src/barchart/horizontal/bar/bar.pri b/src/barchart/horizontal/bar/bar.pri new file mode 100644 index 0000000..897d649 --- /dev/null +++ b/src/barchart/horizontal/bar/bar.pri @@ -0,0 +1,13 @@ +INCLUDEPATH += $$PWD +DEPENDPATH += $$PWD + +SOURCES += \ + $$PWD/qhorizontalbarseries.cpp \ + $$PWD/horizontalbarchartitem.cpp + +PRIVATE_HEADERS += \ + $$PWD/qhorizontalbarseries_p.h \ + $$PWD/horizontalbarchartitem_p.h + +PUBLIC_HEADERS += \ + $$PWD/qhorizontalbarseries.h diff --git a/src/barchart/horizontalbarchartitem.cpp b/src/barchart/horizontal/bar/horizontalbarchartitem.cpp similarity index 100% rename from src/barchart/horizontalbarchartitem.cpp rename to src/barchart/horizontal/bar/horizontalbarchartitem.cpp diff --git a/src/barchart/horizontalbarchartitem_p.h b/src/barchart/horizontal/bar/horizontalbarchartitem_p.h similarity index 100% rename from src/barchart/horizontalbarchartitem_p.h rename to src/barchart/horizontal/bar/horizontalbarchartitem_p.h diff --git a/src/barchart/qhorizontalbarseries.cpp b/src/barchart/horizontal/bar/qhorizontalbarseries.cpp similarity index 70% rename from src/barchart/qhorizontalbarseries.cpp rename to src/barchart/horizontal/bar/qhorizontalbarseries.cpp index d29daaf..f22604f 100644 --- a/src/barchart/qhorizontalbarseries.cpp +++ b/src/barchart/horizontal/bar/qhorizontalbarseries.cpp @@ -1,3 +1,23 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the Qt Commercial Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qhorizontalbarseries.h" #include "qhorizontalbarseries_p.h" #include "horizontalbarchartitem_p.h" @@ -20,8 +40,6 @@ QAbstractSeries::SeriesType QHorizontalBarSeries::type() const return QAbstractSeries::SeriesTypeHorizontalBar; } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// QHorizontalBarSeriesPrivate::QHorizontalBarSeriesPrivate(QHorizontalBarSeries *q) : QAbstractBarSeriesPrivate(q) @@ -46,7 +64,6 @@ void QHorizontalBarSeriesPrivate::scaleDomain(Domain& domain) domain.setRange(minX,maxX,minY,maxY); } - Chart* QHorizontalBarSeriesPrivate::createGraphics(ChartPresenter* presenter) { Q_Q(QHorizontalBarSeries); @@ -60,30 +77,6 @@ Chart* QHorizontalBarSeriesPrivate::createGraphics(ChartPresenter* presenter) return bar; } -void QHorizontalBarSeriesPrivate::initializeAxis(QAbstractAxis* axis) -{ - - if(axis->type()==QAbstractAxis::AxisTypeCategories && axis->orientation()==Qt::Vertical) - { - QBarCategoriesAxis* cataxis = qobject_cast(axis); - Q_ASSERT(cataxis); - QStringList categories; - if(cataxis->categories().isEmpty()){ - for (int i(1); i < categoryCount()+1; i++) - categories << QString::number(i); - cataxis->append(categories); - } - } -} - -QAbstractAxis::AxisType QHorizontalBarSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const -{ - if(orientation==Qt::Vertical) - return QAbstractAxis::AxisTypeCategories; - else - return QAbstractAxis::AxisTypeValues; -} - #include "moc_qhorizontalbarseries.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/qhorizontalbarseries.h b/src/barchart/horizontal/bar/qhorizontalbarseries.h similarity index 100% rename from src/barchart/qhorizontalbarseries.h rename to src/barchart/horizontal/bar/qhorizontalbarseries.h diff --git a/src/barchart/qhorizontalbarseries_p.h b/src/barchart/horizontal/bar/qhorizontalbarseries_p.h similarity index 97% rename from src/barchart/qhorizontalbarseries_p.h rename to src/barchart/horizontal/bar/qhorizontalbarseries_p.h index 8575bef..1bc22c4 100644 --- a/src/barchart/qhorizontalbarseries_p.h +++ b/src/barchart/horizontal/bar/qhorizontalbarseries_p.h @@ -41,9 +41,6 @@ public: QHorizontalBarSeriesPrivate(QHorizontalBarSeries* q); Chart* createGraphics(ChartPresenter* presenter); void scaleDomain(Domain& domain); - void initializeAxis(QAbstractAxis* axis); - QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const; - private: Q_DECLARE_PUBLIC(QHorizontalBarSeries) }; diff --git a/src/barchart/horizontal/horizontal.pri b/src/barchart/horizontal/horizontal.pri new file mode 100644 index 0000000..cf5c716 --- /dev/null +++ b/src/barchart/horizontal/horizontal.pri @@ -0,0 +1,3 @@ +include(bar/bar.pri) +include(percent/percent.pri) +include(stacked/stacked.pri) \ No newline at end of file diff --git a/src/barchart/horizontalpercentbarchartitem.cpp b/src/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp similarity index 100% rename from src/barchart/horizontalpercentbarchartitem.cpp rename to src/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp diff --git a/src/barchart/horizontalpercentbarchartitem_p.h b/src/barchart/horizontal/percent/horizontalpercentbarchartitem_p.h similarity index 100% rename from src/barchart/horizontalpercentbarchartitem_p.h rename to src/barchart/horizontal/percent/horizontalpercentbarchartitem_p.h diff --git a/src/barchart/horizontal/percent/percent.pri b/src/barchart/horizontal/percent/percent.pri new file mode 100644 index 0000000..cc7b6d2 --- /dev/null +++ b/src/barchart/horizontal/percent/percent.pri @@ -0,0 +1,13 @@ +INCLUDEPATH += $$PWD +DEPENDPATH += $$PWD + +SOURCES += \ + $$PWD/qhorizontalpercentbarseries.cpp \ + $$PWD/horizontalpercentbarchartitem.cpp + +PRIVATE_HEADERS += \ + $$PWD/qhorizontalpercentbarseries_p.h \ + $$PWD/horizontalpercentbarchartitem_p.h + +PUBLIC_HEADERS += \ + $$PWD/qhorizontalpercentbarseries.h diff --git a/src/barchart/qhorizontalpercentbarseries.cpp b/src/barchart/horizontal/percent/qhorizontalpercentbarseries.cpp similarity index 100% rename from src/barchart/qhorizontalpercentbarseries.cpp rename to src/barchart/horizontal/percent/qhorizontalpercentbarseries.cpp diff --git a/src/barchart/qhorizontalpercentbarseries.h b/src/barchart/horizontal/percent/qhorizontalpercentbarseries.h similarity index 100% rename from src/barchart/qhorizontalpercentbarseries.h rename to src/barchart/horizontal/percent/qhorizontalpercentbarseries.h diff --git a/src/barchart/qhorizontalpercentbarseries_p.h b/src/barchart/horizontal/percent/qhorizontalpercentbarseries_p.h similarity index 100% rename from src/barchart/qhorizontalpercentbarseries_p.h rename to src/barchart/horizontal/percent/qhorizontalpercentbarseries_p.h index 6b6c104..8327bc3 100644 --- a/src/barchart/qhorizontalpercentbarseries_p.h +++ b/src/barchart/horizontal/percent/qhorizontalpercentbarseries_p.h @@ -41,7 +41,6 @@ public: QHorizontalPercentBarSeriesPrivate(QHorizontalPercentBarSeries* q); Chart* createGraphics(ChartPresenter* presenter); void scaleDomain(Domain& domain); - private: Q_DECLARE_PUBLIC(QHorizontalPercentBarSeries) }; diff --git a/src/barchart/horizontalstackedbarchartitem.cpp b/src/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp similarity index 100% rename from src/barchart/horizontalstackedbarchartitem.cpp rename to src/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp diff --git a/src/barchart/horizontalstackedbarchartitem_p.h b/src/barchart/horizontal/stacked/horizontalstackedbarchartitem_p.h similarity index 100% rename from src/barchart/horizontalstackedbarchartitem_p.h rename to src/barchart/horizontal/stacked/horizontalstackedbarchartitem_p.h diff --git a/src/barchart/qhorizontalstackedbarseries.cpp b/src/barchart/horizontal/stacked/qhorizontalstackedbarseries.cpp similarity index 90% rename from src/barchart/qhorizontalstackedbarseries.cpp rename to src/barchart/horizontal/stacked/qhorizontalstackedbarseries.cpp index f39d15d..b7cadc3 100644 --- a/src/barchart/qhorizontalstackedbarseries.cpp +++ b/src/barchart/horizontal/stacked/qhorizontalstackedbarseries.cpp @@ -57,17 +57,6 @@ Chart* QHorizontalStackedBarSeriesPrivate::createGraphics(ChartPresenter* presen return bar; } -QAbstractAxis::AxisType QHorizontalStackedBarSeriesPrivate::defaultAxisXType() const -{ - return QAbstractAxis::AxisTypeValues; -} - -QAbstractAxis::AxisType QHorizontalStackedBarSeriesPrivate::defaultAxisYType() const -{ - return QAbstractAxis::AxisTypeCategories; -} - - #include "moc_qhorizontalstackedbarseries.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/qhorizontalstackedbarseries.h b/src/barchart/horizontal/stacked/qhorizontalstackedbarseries.h similarity index 100% rename from src/barchart/qhorizontalstackedbarseries.h rename to src/barchart/horizontal/stacked/qhorizontalstackedbarseries.h diff --git a/src/barchart/qhorizontalstackedbarseries_p.h b/src/barchart/horizontal/stacked/qhorizontalstackedbarseries_p.h similarity index 97% rename from src/barchart/qhorizontalstackedbarseries_p.h rename to src/barchart/horizontal/stacked/qhorizontalstackedbarseries_p.h index 9270b6d..32f0564 100644 --- a/src/barchart/qhorizontalstackedbarseries_p.h +++ b/src/barchart/horizontal/stacked/qhorizontalstackedbarseries_p.h @@ -41,9 +41,6 @@ public: QHorizontalStackedBarSeriesPrivate(QHorizontalStackedBarSeries* q); Chart* createGraphics(ChartPresenter* presenter); void scaleDomain(Domain& domain); - QAbstractAxis::AxisType defaultAxisXType() const; - QAbstractAxis::AxisType defaultAxisYType() const; - private: Q_DECLARE_PUBLIC(QHorizontalStackedBarSeries) }; diff --git a/src/barchart/horizontal/stacked/stacked.pri b/src/barchart/horizontal/stacked/stacked.pri new file mode 100644 index 0000000..0e1c101 --- /dev/null +++ b/src/barchart/horizontal/stacked/stacked.pri @@ -0,0 +1,15 @@ +INCLUDEPATH += $$PWD +DEPENDPATH += $$PWD + +SOURCES += \ + $$PWD/qhorizontalstackedbarseries.cpp \ + $$PWD/horizontalstackedbarchartitem.cpp + + +PRIVATE_HEADERS += \ + $$PWD/qhorizontalstackedbarseries_p.h \ + $$PWD/horizontalstackedbarchartitem_p.h + +PUBLIC_HEADERS += \ + $$PWD/qhorizontalstackedbarseries.h + diff --git a/src/barchart/qabstractbarseries.cpp b/src/barchart/qabstractbarseries.cpp index 9626907..1a3a5c4 100644 --- a/src/barchart/qabstractbarseries.cpp +++ b/src/barchart/qabstractbarseries.cpp @@ -189,11 +189,10 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! - Constructs empty QAbstractBarSeries. - QAbstractBarSeries is QObject which is a child of a \a parent. + This is depreciated constructor. */ QAbstractBarSeries::QAbstractBarSeries(QObject *parent) : - QAbstractSeries(*new QAbstractBarSeriesPrivate(this),parent) + QAbstractSeries(*(QAbstractBarSeriesPrivate*)(0),parent) { } @@ -701,25 +700,84 @@ bool QAbstractBarSeriesPrivate::insert(int index, QBarSet *set) void QAbstractBarSeriesPrivate::initializeAxis(QAbstractAxis* axis) { - if(axis->type()==QAbstractAxis::AxisTypeCategories && axis->orientation()==Qt::Horizontal) - { - QBarCategoriesAxis* cataxis = qobject_cast(axis); - Q_ASSERT(cataxis); - QStringList categories; - if(cataxis->categories().isEmpty()){ - for (int i(1); i < categoryCount()+1; i++) - categories << QString::number(i); - cataxis->append(categories); + Q_Q(QAbstractBarSeries); + + if(axis->type()==QAbstractAxis::AxisTypeCategories) { + + switch(q->type()) { + + case QAbstractSeries::SeriesTypeHorizontalBar: + case QAbstractSeries::SeriesTypeHorizontalPercentBar: + case QAbstractSeries::SeriesTypeHorizontalStackedBar: { + + if(axis->orientation()==Qt::Vertical) + { + populateCategories(qobject_cast(axis)); + } + break; + } + case QAbstractSeries::SeriesTypeBar: + case QAbstractSeries::SeriesTypePercentBar: + case QAbstractSeries::SeriesTypeStackedBar: { + + if(axis->orientation()==Qt::Horizontal) + { + populateCategories(qobject_cast(axis)); + } + break; + } + default: + qWarning()<<"Unexpected series type"; + break; + } } } QAbstractAxis::AxisType QAbstractBarSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const { - Q_UNUSED(orientation); - return QAbstractAxis::AxisTypeNoAxis; + Q_Q(const QAbstractBarSeries); + + switch(q->type()) { + + case QAbstractSeries::SeriesTypeHorizontalBar: + case QAbstractSeries::SeriesTypeHorizontalPercentBar: + case QAbstractSeries::SeriesTypeHorizontalStackedBar: { + + if(orientation==Qt::Vertical) + { + return QAbstractAxis::AxisTypeCategories; + } + break; + } + case QAbstractSeries::SeriesTypeBar: + case QAbstractSeries::SeriesTypePercentBar: + case QAbstractSeries::SeriesTypeStackedBar: { + + if(orientation==Qt::Horizontal) + { + return QAbstractAxis::AxisTypeCategories; + } + break; + } + default: + qWarning()<<"Unexpected series type"; + break; + + } + return QAbstractAxis::AxisTypeValues; + } +void QAbstractBarSeriesPrivate::populateCategories(QBarCategoriesAxis* axis) +{ + QStringList categories; + if(axis->categories().isEmpty()) { + for (int i(1); i < categoryCount()+1; i++) + categories << QString::number(i); + axis->append(categories); + } +} #include "moc_qabstractbarseries.cpp" #include "moc_qabstractbarseries_p.cpp" diff --git a/src/barchart/qabstractbarseries.h b/src/barchart/qabstractbarseries.h index 2cabe49..54195af 100644 --- a/src/barchart/qabstractbarseries.h +++ b/src/barchart/qabstractbarseries.h @@ -38,6 +38,7 @@ class QTCOMMERCIALCHART_EXPORT QAbstractBarSeries : public QAbstractSeries Q_PROPERTY(bool labelsVisible READ isLabelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged) protected: + //TODO DEPRECIATED explicit QAbstractBarSeries(QObject *parent = 0); public: diff --git a/src/barchart/qabstractbarseries_p.h b/src/barchart/qabstractbarseries_p.h index d303761..37d9e7c 100644 --- a/src/barchart/qabstractbarseries_p.h +++ b/src/barchart/qabstractbarseries_p.h @@ -38,6 +38,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE class QBarModelMapper; +class QBarCategoriesAxis; class QAbstractBarSeriesPrivate : public QAbstractSeriesPrivate { @@ -82,6 +83,9 @@ Q_SIGNALS: void restructuredBars(); void labelsVisibleChanged(bool visible); +private: + void populateCategories(QBarCategoriesAxis* axis); + protected: QList m_barSets; qreal m_barWidth; diff --git a/src/barchart/vertical/bar/bar.pri b/src/barchart/vertical/bar/bar.pri new file mode 100644 index 0000000..9d63dfb --- /dev/null +++ b/src/barchart/vertical/bar/bar.pri @@ -0,0 +1,13 @@ +INCLUDEPATH += $$PWD +DEPENDPATH += $$PWD + +SOURCES += \ + $$PWD/barchartitem.cpp \ + $$PWD/qbarseries.cpp + +PRIVATE_HEADERS += \ + $$PWD/barchartitem_p.h \ + $$PWD/qbarseries_p.h + +PUBLIC_HEADERS += \ + $$PWD/qbarseries.h diff --git a/src/barchart/barchartitem.cpp b/src/barchart/vertical/bar/barchartitem.cpp similarity index 100% rename from src/barchart/barchartitem.cpp rename to src/barchart/vertical/bar/barchartitem.cpp diff --git a/src/barchart/barchartitem_p.h b/src/barchart/vertical/bar/barchartitem_p.h similarity index 100% rename from src/barchart/barchartitem_p.h rename to src/barchart/vertical/bar/barchartitem_p.h diff --git a/src/barchart/qbarseries.cpp b/src/barchart/vertical/bar/qbarseries.cpp similarity index 95% rename from src/barchart/qbarseries.cpp rename to src/barchart/vertical/bar/qbarseries.cpp index 2b8814f..dac5043 100644 --- a/src/barchart/qbarseries.cpp +++ b/src/barchart/vertical/bar/qbarseries.cpp @@ -26,6 +26,7 @@ #include "chartanimator_p.h" #include "baranimation_p.h" #include "qvaluesaxis.h" +#include "qbarcategoriesaxis.h" QTCOMMERCIALCHART_BEGIN_NAMESPACE @@ -110,14 +111,6 @@ Chart* QBarSeriesPrivate::createGraphics(ChartPresenter* presenter) return bar; } -QAbstractAxis::AxisType QBarSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const -{ - if(orientation==Qt::Horizontal) - return QAbstractAxis::AxisTypeCategories; - else - return QAbstractAxis::AxisTypeValues; -} - #include "moc_qbarseries.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/qbarseries.h b/src/barchart/vertical/bar/qbarseries.h similarity index 100% rename from src/barchart/qbarseries.h rename to src/barchart/vertical/bar/qbarseries.h diff --git a/src/barchart/qbarseries_p.h b/src/barchart/vertical/bar/qbarseries_p.h similarity index 98% rename from src/barchart/qbarseries_p.h rename to src/barchart/vertical/bar/qbarseries_p.h index 701e081..8c66910 100644 --- a/src/barchart/qbarseries_p.h +++ b/src/barchart/vertical/bar/qbarseries_p.h @@ -42,10 +42,6 @@ public: QBarSeriesPrivate(QBarSeries* q); Chart* createGraphics(ChartPresenter* presenter); void scaleDomain(Domain& domain); - - QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const; - - private: Q_DECLARE_PUBLIC(QBarSeries) }; diff --git a/src/barchart/vertical/percent/percent.pri b/src/barchart/vertical/percent/percent.pri new file mode 100644 index 0000000..8fac3c7 --- /dev/null +++ b/src/barchart/vertical/percent/percent.pri @@ -0,0 +1,14 @@ +INCLUDEPATH += $$PWD +DEPENDPATH += $$PWD + +SOURCES += \ + $$PWD/percentbarchartitem.cpp \ + $$PWD/qpercentbarseries.cpp + + +PRIVATE_HEADERS += \ + $$PWD/percentbarchartitem_p.h \ + $$PWD/qpercentbarseries_p.h + +PUBLIC_HEADERS += \ + $$PWD/qpercentbarseries.h diff --git a/src/barchart/percentbarchartitem.cpp b/src/barchart/vertical/percent/percentbarchartitem.cpp similarity index 100% rename from src/barchart/percentbarchartitem.cpp rename to src/barchart/vertical/percent/percentbarchartitem.cpp diff --git a/src/barchart/percentbarchartitem_p.h b/src/barchart/vertical/percent/percentbarchartitem_p.h similarity index 100% rename from src/barchart/percentbarchartitem_p.h rename to src/barchart/vertical/percent/percentbarchartitem_p.h diff --git a/src/barchart/qpercentbarseries.cpp b/src/barchart/vertical/percent/qpercentbarseries.cpp similarity index 96% rename from src/barchart/qpercentbarseries.cpp rename to src/barchart/vertical/percent/qpercentbarseries.cpp index aa52c78..398778b 100644 --- a/src/barchart/qpercentbarseries.cpp +++ b/src/barchart/vertical/percent/qpercentbarseries.cpp @@ -109,15 +109,6 @@ Chart* QPercentBarSeriesPrivate::createGraphics(ChartPresenter* presenter) return bar; } -QAbstractAxis::AxisType QPercentBarSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const -{ - if(orientation==Qt::Horizontal) - return QAbstractAxis::AxisTypeCategories; - else - return QAbstractAxis::AxisTypeValues; -} - - #include "moc_qpercentbarseries.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/qpercentbarseries.h b/src/barchart/vertical/percent/qpercentbarseries.h similarity index 100% rename from src/barchart/qpercentbarseries.h rename to src/barchart/vertical/percent/qpercentbarseries.h diff --git a/src/barchart/qpercentbarseries_p.h b/src/barchart/vertical/percent/qpercentbarseries_p.h similarity index 98% rename from src/barchart/qpercentbarseries_p.h rename to src/barchart/vertical/percent/qpercentbarseries_p.h index ffcd494..88ba693 100644 --- a/src/barchart/qpercentbarseries_p.h +++ b/src/barchart/vertical/percent/qpercentbarseries_p.h @@ -42,8 +42,6 @@ public: QPercentBarSeriesPrivate(QPercentBarSeries* q); void scaleDomain(Domain& domain); Chart* createGraphics(ChartPresenter* presenter); - QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const; - private: Q_DECLARE_PUBLIC(QPercentBarSeries) }; diff --git a/src/barchart/qstackedbarseries.cpp b/src/barchart/vertical/stacked/qstackedbarseries.cpp similarity index 96% rename from src/barchart/qstackedbarseries.cpp rename to src/barchart/vertical/stacked/qstackedbarseries.cpp index 9170293..28290a0 100644 --- a/src/barchart/qstackedbarseries.cpp +++ b/src/barchart/vertical/stacked/qstackedbarseries.cpp @@ -111,15 +111,6 @@ Chart* QStackedBarSeriesPrivate::createGraphics(ChartPresenter* presenter) return bar; } -QAbstractAxis::AxisType QStackedBarSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const -{ - if(orientation==Qt::Horizontal) - return QAbstractAxis::AxisTypeCategories; - else - return QAbstractAxis::AxisTypeValues; -} - - #include "moc_qstackedbarseries.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/qstackedbarseries.h b/src/barchart/vertical/stacked/qstackedbarseries.h similarity index 100% rename from src/barchart/qstackedbarseries.h rename to src/barchart/vertical/stacked/qstackedbarseries.h diff --git a/src/barchart/qstackedbarseries_p.h b/src/barchart/vertical/stacked/qstackedbarseries_p.h similarity index 98% rename from src/barchart/qstackedbarseries_p.h rename to src/barchart/vertical/stacked/qstackedbarseries_p.h index 62b2507..475c0bf 100644 --- a/src/barchart/qstackedbarseries_p.h +++ b/src/barchart/vertical/stacked/qstackedbarseries_p.h @@ -42,8 +42,6 @@ public: QStackedBarSeriesPrivate(QStackedBarSeries* q); Chart* createGraphics(ChartPresenter* presenter); void scaleDomain(Domain& domain); - QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const; - private: Q_DECLARE_PUBLIC(QStackedBarSeries) }; diff --git a/src/barchart/vertical/stacked/stacked.pri b/src/barchart/vertical/stacked/stacked.pri new file mode 100644 index 0000000..8344ebe --- /dev/null +++ b/src/barchart/vertical/stacked/stacked.pri @@ -0,0 +1,13 @@ +INCLUDEPATH += $$PWD +DEPENDPATH += $$PWD + +SOURCES += \ + $$PWD/qstackedbarseries.cpp \ + $$PWD/stackedbarchartitem.cpp + +PRIVATE_HEADERS += \ + $$PWD/stackedbarchartitem_p.h \ + $$PWD/qstackedbarseries_p.h + +PUBLIC_HEADERS += \ + $$PWD/qstackedbarseries.h diff --git a/src/barchart/stackedbarchartitem.cpp b/src/barchart/vertical/stacked/stackedbarchartitem.cpp similarity index 100% rename from src/barchart/stackedbarchartitem.cpp rename to src/barchart/vertical/stacked/stackedbarchartitem.cpp diff --git a/src/barchart/stackedbarchartitem_p.h b/src/barchart/vertical/stacked/stackedbarchartitem_p.h similarity index 100% rename from src/barchart/stackedbarchartitem_p.h rename to src/barchart/vertical/stacked/stackedbarchartitem_p.h diff --git a/src/barchart/vertical/vertical.pri b/src/barchart/vertical/vertical.pri new file mode 100644 index 0000000..cf5c716 --- /dev/null +++ b/src/barchart/vertical/vertical.pri @@ -0,0 +1,3 @@ +include(bar/bar.pri) +include(percent/percent.pri) +include(stacked/stacked.pri) \ No newline at end of file