diff --git a/demos/qmlchart/qml/qmlchart/View6.qml b/demos/qmlchart/qml/qmlchart/View6.qml index 77c64f5..b8c604a 100644 --- a/demos/qmlchart/qml/qmlchart/View6.qml +++ b/demos/qmlchart/qml/qmlchart/View6.qml @@ -29,7 +29,7 @@ Rectangle { title: "Bar series" anchors.fill: parent legend.alignment: Qt.AlignBottom - CategoriesAxis { + BarCategoriesAxis { id:myAxis categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } diff --git a/demos/qmlchart/qml/qmlchart/View7.qml b/demos/qmlchart/qml/qmlchart/View7.qml index 90a65c2..9f9585d 100644 --- a/demos/qmlchart/qml/qmlchart/View7.qml +++ b/demos/qmlchart/qml/qmlchart/View7.qml @@ -29,7 +29,7 @@ Rectangle { title: "Stacked Bar series" anchors.fill: parent legend.alignment: Qt.AlignBottom - CategoriesAxis { + BarCategoriesAxis { id: myAxis; categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } diff --git a/demos/qmlchart/qml/qmlchart/View8.qml b/demos/qmlchart/qml/qmlchart/View8.qml index da97012..f679e06 100644 --- a/demos/qmlchart/qml/qmlchart/View8.qml +++ b/demos/qmlchart/qml/qmlchart/View8.qml @@ -29,7 +29,7 @@ Rectangle { title: "Percent Bar series" anchors.fill: parent legend.alignment: Qt.AlignBottom - CategoriesAxis { + BarCategoriesAxis { id: myAxis categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } diff --git a/demos/qmlcustommodel/qml/qmlcustommodel/main.qml b/demos/qmlcustommodel/qml/qmlcustommodel/main.qml index b1b4b2a..912f38a 100644 --- a/demos/qmlcustommodel/qml/qmlcustommodel/main.qml +++ b/demos/qmlcustommodel/qml/qmlcustommodel/main.qml @@ -32,7 +32,7 @@ Rectangle { anchors.fill: parent animationOptions: ChartView.SeriesAnimations - CategoriesAxis { + BarCategoriesAxis { id: categoryAxis categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } diff --git a/examples/barchart/main.cpp b/examples/barchart/main.cpp index ccedb8b..fe00fde 100644 --- a/examples/barchart/main.cpp +++ b/examples/barchart/main.cpp @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) //![4] QStringList categories; categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; - QCategoriesAxis* axis = new QCategoriesAxis(); + QBarCategoriesAxis* axis = new QBarCategoriesAxis(); axis->append(categories); chart->setAxisX(axis,series); //![4] diff --git a/examples/barmodelmapper/tablewidget.cpp b/examples/barmodelmapper/tablewidget.cpp index 53522ef..646c0c3 100644 --- a/examples/barmodelmapper/tablewidget.cpp +++ b/examples/barmodelmapper/tablewidget.cpp @@ -88,7 +88,7 @@ TableWidget::TableWidget(QWidget *parent) //! [6] QStringList categories; categories << "April" << "May" << "June" << "July" << "August"; - QCategoriesAxis* axis = new QCategoriesAxis(); + QBarCategoriesAxis* axis = new QBarCategoriesAxis(); axis->append(categories); chart->createDefaultAxes(); chart->setAxisX(axis, series); diff --git a/examples/percentbarchart/main.cpp b/examples/percentbarchart/main.cpp index 2a2b967..b66ccdc 100644 --- a/examples/percentbarchart/main.cpp +++ b/examples/percentbarchart/main.cpp @@ -64,7 +64,7 @@ int main(int argc, char *argv[]) //![4] QStringList categories; categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; - QCategoriesAxis* axis = new QCategoriesAxis(); + QBarCategoriesAxis* axis = new QBarCategoriesAxis(); axis->append(categories); chart->createDefaultAxes(); chart->setAxisX(axis,series); diff --git a/examples/stackedbarchart/main.cpp b/examples/stackedbarchart/main.cpp index 1d70582..e2d7b55 100644 --- a/examples/stackedbarchart/main.cpp +++ b/examples/stackedbarchart/main.cpp @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) //![4] QStringList categories; categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; - QCategoriesAxis* axis = new QCategoriesAxis(); + QBarCategoriesAxis* axis = new QBarCategoriesAxis(); axis->append(categories); chart->setAxisX(axis,series); //![4] diff --git a/examples/stackedbarchartdrilldown/drilldownchart.cpp b/examples/stackedbarchartdrilldown/drilldownchart.cpp index edc2529..b065beb 100644 --- a/examples/stackedbarchartdrilldown/drilldownchart.cpp +++ b/examples/stackedbarchartdrilldown/drilldownchart.cpp @@ -38,7 +38,7 @@ void DrilldownChart::changeSeries(DrilldownBarSeries *series) m_currentSeries = series; // Reset axis - QCategoriesAxis* axis = new QCategoriesAxis(); + QBarCategoriesAxis* axis = new QBarCategoriesAxis(); axis->append(m_currentSeries->categories()); addSeries(series); diff --git a/plugins/declarative/plugin.cpp b/plugins/declarative/plugin.cpp index 0b486b8..8542a4b 100644 --- a/plugins/declarative/plugin.cpp +++ b/plugins/declarative/plugin.cpp @@ -68,7 +68,7 @@ public: qmlRegisterType(uri, 1, 0, "HBarModelMapper"); qmlRegisterType(uri, 1, 0, "VBarModelMapper"); qmlRegisterType(uri, 1, 0, "ValuesAxis"); - qmlRegisterType(uri, 1, 0, "CategoriesAxis"); + qmlRegisterType(uri, 1, 0, "BarCategoriesAxis"); qmlRegisterUncreatableType(uri, 1, 0, "Legend", QLatin1String("Trying to create uncreatable: Legend.")); diff --git a/src/axis/chartcategoriesaxisx.cpp b/src/axis/chartcategoriesaxisx.cpp index aff32fb..3d22f1d 100644 --- a/src/axis/chartcategoriesaxisx.cpp +++ b/src/axis/chartcategoriesaxisx.cpp @@ -31,7 +31,7 @@ static int label_padding = 5; QTCOMMERCIALCHART_BEGIN_NAMESPACE -ChartCategoriesAxisX::ChartCategoriesAxisX(QCategoriesAxis *axis,ChartPresenter *presenter) : ChartAxis(axis,presenter), +ChartCategoriesAxisX::ChartCategoriesAxisX(QBarCategoriesAxis *axis,ChartPresenter *presenter) : ChartAxis(axis,presenter), m_categoriesAxis(axis) { diff --git a/src/axis/chartcategoriesaxisx_p.h b/src/axis/chartcategoriesaxisx_p.h index ebacb24..f206a19 100644 --- a/src/axis/chartcategoriesaxisx_p.h +++ b/src/axis/chartcategoriesaxisx_p.h @@ -36,12 +36,12 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE class QAbstractAxis; class ChartPresenter; -class QCategoriesAxis; +class QBarCategoriesAxis; class ChartCategoriesAxisX : public ChartAxis { public: - ChartCategoriesAxisX(QCategoriesAxis *axis, ChartPresenter *presenter); + ChartCategoriesAxisX(QBarCategoriesAxis *axis, ChartPresenter *presenter); ~ChartCategoriesAxisX(); AxisType axisType() const { return X_AXIS;} @@ -51,7 +51,7 @@ protected: void updateGeometry(); private: - QCategoriesAxis *m_categoriesAxis; + QBarCategoriesAxis *m_categoriesAxis; }; QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/axis/chartcategoriesaxisy_p.h b/src/axis/chartcategoriesaxisy_p.h index c282e7e..278afec 100644 --- a/src/axis/chartcategoriesaxisy_p.h +++ b/src/axis/chartcategoriesaxisy_p.h @@ -35,7 +35,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE class QAbstractAxis; -class QCategoriesAxis; +class QBarCategoriesAxis; class ChartPresenter; class ChartCategoriesAxisY : public ChartAxis @@ -51,7 +51,7 @@ protected: void updateGeometry(); private: - QCategoriesAxis *m_categoriesAxis; + QBarCategoriesAxis *m_categoriesAxis; }; QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/axis/qcategoriesaxis.cpp b/src/axis/qcategoriesaxis.cpp index a03e423..952904b 100644 --- a/src/axis/qcategoriesaxis.cpp +++ b/src/axis/qcategoriesaxis.cpp @@ -27,16 +27,16 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE -QCategoriesAxis::QCategoriesAxis(QObject *parent): - QAbstractAxis(*new QCategoriesAxisPrivate(this),parent) +QBarCategoriesAxis::QBarCategoriesAxis(QObject *parent): + QAbstractAxis(*new QBarCategoriesAxisPrivate(this),parent) { } -QCategoriesAxis::~QCategoriesAxis() +QBarCategoriesAxis::~QBarCategoriesAxis() { } -QCategoriesAxis::QCategoriesAxis(QCategoriesAxisPrivate &d,QObject *parent):QAbstractAxis(d,parent) +QBarCategoriesAxis::QBarCategoriesAxis(QBarCategoriesAxisPrivate &d,QObject *parent):QAbstractAxis(d,parent) { } @@ -44,9 +44,9 @@ QCategoriesAxis::QCategoriesAxis(QCategoriesAxisPrivate &d,QObject *parent):QAbs /*! Appends \a categories to axis */ -void QCategoriesAxis::append(const QStringList &categories) +void QBarCategoriesAxis::append(const QStringList &categories) { - Q_D(QCategoriesAxis); + Q_D(QBarCategoriesAxis); if (d->m_categories.isEmpty()) { d->m_categories.append(categories); setRange(categories.first(),categories.last()); @@ -60,9 +60,9 @@ void QCategoriesAxis::append(const QStringList &categories) /*! Appends \a category to axis */ -void QCategoriesAxis::append(const QString &category) +void QBarCategoriesAxis::append(const QString &category) { - Q_D(QCategoriesAxis); + Q_D(QBarCategoriesAxis); if (d->m_categories.isEmpty()) { d->m_categories.append(category); setRange(category,category); @@ -75,9 +75,9 @@ void QCategoriesAxis::append(const QString &category) /*! Removes \a category from axis */ -void QCategoriesAxis::remove(const QString &category) +void QBarCategoriesAxis::remove(const QString &category) { - Q_D(QCategoriesAxis); + Q_D(QBarCategoriesAxis); if (d->m_categories.contains(category)) { d->m_categories.removeAt(d->m_categories.indexOf(category)); setRange(d->m_categories.first(),d->m_categories.last()); @@ -88,9 +88,9 @@ void QCategoriesAxis::remove(const QString &category) /*! Inserts \a category to axis at \a index */ -void QCategoriesAxis::insert(int index, const QString &category) +void QBarCategoriesAxis::insert(int index, const QString &category) { - Q_D(QCategoriesAxis); + Q_D(QBarCategoriesAxis); if (d->m_categories.isEmpty()) { d->m_categories.insert(index,category); setRange(category,category); @@ -103,17 +103,17 @@ void QCategoriesAxis::insert(int index, const QString &category) /*! Removes all categories. */ -void QCategoriesAxis::clear() +void QBarCategoriesAxis::clear() { - Q_D(QCategoriesAxis); + Q_D(QBarCategoriesAxis); d->m_categories.clear(); setRange(QString::null,QString::null); emit categoriesChanged(); } -void QCategoriesAxis::setCategories(const QStringList &categories) +void QBarCategoriesAxis::setCategories(const QStringList &categories) { - Q_D(QCategoriesAxis); + Q_D(QBarCategoriesAxis); if(d->m_categories!=categories){ d->m_categories = categories; setRange(categories.first(),categories.last()); @@ -121,72 +121,72 @@ void QCategoriesAxis::setCategories(const QStringList &categories) } } -QStringList QCategoriesAxis::categories() +QStringList QBarCategoriesAxis::categories() { - Q_D(QCategoriesAxis); + Q_D(QBarCategoriesAxis); return d->m_categories; } /*! Returns number of categories. */ -int QCategoriesAxis::count() const +int QBarCategoriesAxis::count() const { - Q_D(const QCategoriesAxis); + Q_D(const QBarCategoriesAxis); return d->m_categories.count(); } /*! Returns category at \a index. Index must be valid. */ -QString QCategoriesAxis::at(int index) const +QString QBarCategoriesAxis::at(int index) const { - Q_D(const QCategoriesAxis); + Q_D(const QBarCategoriesAxis); return d->m_categories.at(index); } /*! Sets minimum category to \a min. */ -void QCategoriesAxis::setMin(const QString& min) +void QBarCategoriesAxis::setMin(const QString& min) { - Q_D(QCategoriesAxis); + Q_D(QBarCategoriesAxis); setRange(min,d->m_maxCategory); } /*! Returns minimum category. */ -QString QCategoriesAxis::min() const +QString QBarCategoriesAxis::min() const { - Q_D(const QCategoriesAxis); + Q_D(const QBarCategoriesAxis); return d->m_minCategory; } /*! Sets maximum category to \a max. */ -void QCategoriesAxis::setMax(const QString& max) +void QBarCategoriesAxis::setMax(const QString& max) { - Q_D(QCategoriesAxis); + Q_D(QBarCategoriesAxis); setRange(d->m_minCategory,max); } /*! Returns maximum category */ -QString QCategoriesAxis::max() const +QString QBarCategoriesAxis::max() const { - Q_D(const QCategoriesAxis); + Q_D(const QBarCategoriesAxis); return d->m_maxCategory; } /*! Sets range from \a minCategory to \a maxCategory */ -void QCategoriesAxis::setRange(const QString& minCategory, const QString& maxCategory) +void QBarCategoriesAxis::setRange(const QString& minCategory, const QString& maxCategory) { - Q_D(QCategoriesAxis); + Q_D(QBarCategoriesAxis); int minIndex = d->m_categories.indexOf(minCategory); if (minIndex == -1) { @@ -224,57 +224,57 @@ void QCategoriesAxis::setRange(const QString& minCategory, const QString& maxCat /*! Returns the type of axis. */ -QAbstractAxis::AxisType QCategoriesAxis::type() const +QAbstractAxis::AxisType QBarCategoriesAxis::type() const { return AxisTypeCategories; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -QCategoriesAxisPrivate::QCategoriesAxisPrivate(QCategoriesAxis* q): +QBarCategoriesAxisPrivate::QBarCategoriesAxisPrivate(QBarCategoriesAxis* q): QAbstractAxisPrivate(q) { } -QCategoriesAxisPrivate::~QCategoriesAxisPrivate() +QBarCategoriesAxisPrivate::~QBarCategoriesAxisPrivate() { } -void QCategoriesAxisPrivate::setMin(const QVariant &min) +void QBarCategoriesAxisPrivate::setMin(const QVariant &min) { setRange(min,m_maxCategory); } -void QCategoriesAxisPrivate::setMax(const QVariant &max) +void QBarCategoriesAxisPrivate::setMax(const QVariant &max) { setRange(m_minCategory,max); } -void QCategoriesAxisPrivate::setRange(const QVariant &min, const QVariant &max) +void QBarCategoriesAxisPrivate::setRange(const QVariant &min, const QVariant &max) { - Q_Q(QCategoriesAxis); + Q_Q(QBarCategoriesAxis); QString value1 = min.toString(); QString value2 = max.toString(); q->setRange(value1,value2); } -int QCategoriesAxisPrivate::ticksCount() const +int QBarCategoriesAxisPrivate::ticksCount() const { return m_categories.count()+1; } -void QCategoriesAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count) +void QBarCategoriesAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count) { m_min = min; m_max = max; m_ticksCount = count; } -ChartAxis* QCategoriesAxisPrivate::createGraphics(ChartPresenter* presenter) +ChartAxis* QBarCategoriesAxisPrivate::createGraphics(ChartPresenter* presenter) { - Q_Q( QCategoriesAxis); + Q_Q( QBarCategoriesAxis); if(m_orientation == Qt::Vertical){ return new ChartCategoriesAxisY(q,presenter); }else{ @@ -282,9 +282,9 @@ ChartAxis* QCategoriesAxisPrivate::createGraphics(ChartPresenter* presenter) } } -void QCategoriesAxisPrivate::emitRange() +void QBarCategoriesAxisPrivate::emitRange() { - Q_Q( QCategoriesAxis); + Q_Q( QBarCategoriesAxis); if(!q->signalsBlocked()) { emit changed(m_min -0.5, m_max +0.5, qCeil(m_max + 0.5) -qCeil(m_min - 0.5) +1, false); } diff --git a/src/axis/qcategoriesaxis.h b/src/axis/qcategoriesaxis.h index bf27733..b5493ca 100644 --- a/src/axis/qcategoriesaxis.h +++ b/src/axis/qcategoriesaxis.h @@ -25,9 +25,9 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE -class QCategoriesAxisPrivate; +class QBarCategoriesAxisPrivate; -class QTCOMMERCIALCHART_EXPORT QCategoriesAxis : public QAbstractAxis +class QTCOMMERCIALCHART_EXPORT QBarCategoriesAxis : public QAbstractAxis { Q_OBJECT Q_PROPERTY(QStringList categories READ categories WRITE setCategories NOTIFY categoriesChanged) @@ -35,11 +35,11 @@ class QTCOMMERCIALCHART_EXPORT QCategoriesAxis : public QAbstractAxis Q_PROPERTY(QString max READ max WRITE setMax NOTIFY maxChanged) public: - explicit QCategoriesAxis(QObject *parent = 0); - ~QCategoriesAxis(); + explicit QBarCategoriesAxis(QObject *parent = 0); + ~QBarCategoriesAxis(); protected: - QCategoriesAxis(QCategoriesAxisPrivate &d,QObject *parent = 0); + QBarCategoriesAxis(QBarCategoriesAxisPrivate &d,QObject *parent = 0); public: AxisType type() const; @@ -67,8 +67,8 @@ Q_SIGNALS: void rangeChanged(const QString &min, const QString &max); private: - Q_DECLARE_PRIVATE(QCategoriesAxis) - Q_DISABLE_COPY(QCategoriesAxis) + Q_DECLARE_PRIVATE(QBarCategoriesAxis) + Q_DISABLE_COPY(QBarCategoriesAxis) }; QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/axis/qcategoriesaxis_p.h b/src/axis/qcategoriesaxis_p.h index 960ac30..bdbd3d6 100644 --- a/src/axis/qcategoriesaxis_p.h +++ b/src/axis/qcategoriesaxis_p.h @@ -35,13 +35,13 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE -class QCategoriesAxisPrivate : public QAbstractAxisPrivate +class QBarCategoriesAxisPrivate : public QAbstractAxisPrivate { Q_OBJECT public: - QCategoriesAxisPrivate(QCategoriesAxis *q); - ~QCategoriesAxisPrivate(); + QBarCategoriesAxisPrivate(QBarCategoriesAxis *q); + ~QBarCategoriesAxisPrivate(); public: ChartAxis* createGraphics(ChartPresenter* presenter); @@ -66,7 +66,7 @@ private: QString m_maxCategory; private: - Q_DECLARE_PUBLIC(QCategoriesAxis) + Q_DECLARE_PUBLIC(QBarCategoriesAxis) }; QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/qabstractbarseries.cpp b/src/barchart/qabstractbarseries.cpp index 65f0f76..7698c0b 100644 --- a/src/barchart/qabstractbarseries.cpp +++ b/src/barchart/qabstractbarseries.cpp @@ -712,7 +712,7 @@ void QAbstractBarSeriesPrivate::initializeAxisX(QAbstractAxis* axis) { if(axis->type()==QAbstractAxis::AxisTypeCategories) { - QCategoriesAxis* cataxis = qobject_cast(axis); + QBarCategoriesAxis* cataxis = qobject_cast(axis); Q_ASSERT(cataxis); QStringList categories; for (int i(1); i < categoryCount()+1; i++) diff --git a/src/chartdataset.cpp b/src/chartdataset.cpp index 320a1cf..7b7cd47 100644 --- a/src/chartdataset.cpp +++ b/src/chartdataset.cpp @@ -163,7 +163,7 @@ QAbstractAxis* ChartDataSet::createAxis(QAbstractAxis::AxisType type) axis = new QValuesAxis(this); break; case QAbstractAxis::AxisTypeCategories: - axis = new QCategoriesAxis(this); + axis = new QBarCategoriesAxis(this); break; default: axis = 0; diff --git a/tests/chartwidgettest/mainwidget.cpp b/tests/chartwidgettest/mainwidget.cpp index a3227ae..da28d7a 100644 --- a/tests/chartwidgettest/mainwidget.cpp +++ b/tests/chartwidgettest/mainwidget.cpp @@ -275,17 +275,17 @@ void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS QAbstractBarSeries* series = 0; if (seriesName == "Bar") { series = new QBarSeries(this); - QCategoriesAxis* axis = new QCategoriesAxis(); + QBarCategoriesAxis* axis = new QBarCategoriesAxis(); axis->append(category); m_chart->setAxisX(axis,series); } else if (seriesName == "Stacked bar") { series = new QStackedBarSeries(this); - QCategoriesAxis* axis = new QCategoriesAxis(); + QBarCategoriesAxis* axis = new QBarCategoriesAxis(); axis->append(category); m_chart->setAxisX(axis,series); } else { series = new QPercentBarSeries(this); - QCategoriesAxis* axis = new QCategoriesAxis(); + QBarCategoriesAxis* axis = new QBarCategoriesAxis(); axis->append(category); m_chart->setAxisX(axis,series); } diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml index f9d5402..a25226a 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml @@ -29,7 +29,7 @@ ChartView { property variant series: mySeries - CategoriesAxis { + BarCategoriesAxis { id:myAxis; categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml index 94d3e4c..2a176a8 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml @@ -29,7 +29,7 @@ ChartView { property variant series: mySeries - CategoriesAxis { + BarCategoriesAxis { id: myAxis categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml index b793f91..9fc58fe 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml @@ -29,7 +29,7 @@ ChartView { property variant series: mySeries - CategoriesAxis { + BarCategoriesAxis { id: myAxis categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }