From 49d19bd1233e2d3b73ace08f32180237f61c2867 2012-07-16 14:22:43 From: Marek Rosa Date: 2012-07-16 14:22:43 Subject: [PATCH] QIntervalsAxis working somewhat --- diff --git a/src/axis/axis.pri b/src/axis/axis.pri index 5d41458..f7a4c4e 100644 --- a/src/axis/axis.pri +++ b/src/axis/axis.pri @@ -1,5 +1,6 @@ include(valuesaxis/valuesaxis.pri) include(categoriesaxis/categoriesaxis.pri) +include(intervalsaxis/intervalsaxis.pri) INCLUDEPATH += $$PWD DEPENDPATH += $$PWD diff --git a/src/axis/intervalsaxis/chartintervalsaxisx.cpp b/src/axis/intervalsaxis/chartintervalsaxisx.cpp new file mode 100644 index 0000000..0ed8578 --- /dev/null +++ b/src/axis/intervalsaxis/chartintervalsaxisx.cpp @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** 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 "chartintervalsaxisx_p.h" +#include "qabstractaxis.h" +#include "chartpresenter_p.h" +#include "chartanimator_p.h" +#include +#include +#include +#include +#include + +static int label_padding = 5; + +QTCOMMERCIALCHART_BEGIN_NAMESPACE + +ChartIntervalAxisX::ChartIntervalAxisX(QAbstractAxis *axis,ChartPresenter *presenter) : ChartAxis(axis,presenter) +{ +} + +ChartIntervalAxisX::~ChartIntervalAxisX() +{ +} + +QVector ChartIntervalAxisX::calculateLayout() const +{ + QIntervalsAxis *axis = qobject_cast(m_chartAxis); + int tickCount = axis->intervalsLabels().count() + 1; + QVector points; + points.resize(tickCount); + + qreal scale = m_rect.width() / axis->max(); + for (int i = 0; i < tickCount; ++i) + if (i < tickCount - 1) { + int x = axis->intervalMin(axis->intervalsLabels().at(i)) * scale + m_rect.left(); + points[i] = x; + } else { + int x = axis->intervalMax(axis->intervalsLabels().at(i - 1)) * scale + m_rect.left(); + points[i] = x; + } + + return points; +} + +void ChartIntervalAxisX::updateGeometry() +{ + const QVector& layout = ChartAxis::layout(); + + m_minWidth = 0; + m_minHeight = 0; + + if(layout.isEmpty()) return; + + QIntervalsAxis *intervalAxis = qobject_cast(m_chartAxis); + + QStringList ticksList = intervalAxis->intervalsLabels(); + + // createNumberLabels(ticksList,m_min,m_max,layout.size()); + + QList lines = m_grid->childItems(); + QList labels = m_labels->childItems(); + QList shades = m_shades->childItems(); + QList axis = m_axis->childItems(); + + // Q_ASSERT(labels.size() == ticksList.size()); + // Q_ASSERT(layout.size() == ticksList.size()); + + QGraphicsLineItem *lineItem = static_cast(axis.at(0)); + lineItem->setLine(m_rect.left(), m_rect.bottom(), m_rect.right(), m_rect.bottom()); + + // qreal width = 0; + for (int i = 0; i < layout.size(); ++i) { + QGraphicsLineItem *lineItem = static_cast(lines.at(i)); + lineItem->setLine(layout[i], m_rect.top(), layout[i], m_rect.bottom()); + QGraphicsSimpleTextItem *labelItem = static_cast(labels.at(i)); + if (i < ticksList.count()) { + labelItem->setText(ticksList.at(i)); + } + const QRectF& rect = labelItem->boundingRect(); + QPointF center = rect.center(); + labelItem->setTransformOriginPoint(center.x(), center.y()); + if (i < ticksList.count()) + labelItem->setPos(layout[i] + (layout[i + 1] - layout[i]) / 2 - center.x(), m_rect.bottom() + label_padding); + else + labelItem->setPos(layout[i] - center.x(), m_rect.bottom() + label_padding); + + if(labelItem->pos().x() > m_rect.width() + m_rect.left() - rect.width() / 2){ + labelItem->setVisible(false); + lineItem->setVisible(false); + } + + m_minWidth += rect.width(); + m_minHeight = qMax(rect.height(), m_minHeight); + + if ((i + 1) % 2 && i > 1) { + QGraphicsRectItem *rectItem = static_cast(shades.at(i / 2 - 1)); + rectItem->setRect(layout[i - 1],m_rect.top(),layout[i]-layout[i - 1],m_rect.height()); + } + lineItem = static_cast(axis.at(i+1)); + lineItem->setLine(layout[i],m_rect.bottom(),layout[i], m_rect.bottom() + 5); + } +} + +QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/axis/intervalsaxis/chartintervalsaxisx_p.h b/src/axis/intervalsaxis/chartintervalsaxisx_p.h new file mode 100644 index 0000000..6349706 --- /dev/null +++ b/src/axis/intervalsaxis/chartintervalsaxisx_p.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the QtCommercial Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef CHARTINTERVALAXISX_H +#define CHARTINTERVALAXISX_H + +#include "chartaxis_p.h" + +QTCOMMERCIALCHART_BEGIN_NAMESPACE + +class QAbstractAxis; +class ChartPresenter; + +class ChartIntervalAxisX : public ChartAxis +{ +public: + ChartIntervalAxisX(QAbstractAxis *axis, ChartPresenter *presenter); + ~ChartIntervalAxisX(); + + AxisType axisType() const { return X_AXIS;} + +protected: + QVector calculateLayout() const; + void updateGeometry(); + +private: + void createLabels(QStringList &labels,qreal min, qreal max,int ticks) const; + +}; + +QTCOMMERCIALCHART_END_NAMESPACE + +#endif /* CHARTINTERVALAXISX_H */ diff --git a/src/axis/intervalsaxis/chartintervalsaxisy.cpp b/src/axis/intervalsaxis/chartintervalsaxisy.cpp new file mode 100644 index 0000000..cbb7553 --- /dev/null +++ b/src/axis/intervalsaxis/chartintervalsaxisy.cpp @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** 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 "chartintervalsaxisy_p.h" +#include "qabstractaxis.h" +#include "chartpresenter_p.h" +#include "chartanimator_p.h" +#include +#include +#include +#include +#include + +static int label_padding = 5; + +QTCOMMERCIALCHART_BEGIN_NAMESPACE + +ChartIntervalAxisY::ChartIntervalAxisY(QAbstractAxis *axis,ChartPresenter *presenter) : ChartAxis(axis,presenter) +{ +} + +ChartIntervalAxisY::~ChartIntervalAxisY() +{ +} + +QVector ChartIntervalAxisY::calculateLayout() const +{ + QIntervalsAxis *axis = qobject_cast(m_chartAxis); + int tickCount = axis->intervalsLabels().count() + 1; + QVector points; + points.resize(tickCount); + + qreal scale = m_rect.height() / axis->max(); + for (int i = 0; i < tickCount; ++i) + if (i < tickCount - 1) { + int y = -axis->intervalMin(axis->intervalsLabels().at(i)) * scale + m_rect.bottom(); + points[i] = y; + } else { + int y = -axis->intervalMax(axis->intervalsLabels().at(i - 1)) * scale + m_rect.bottom(); + points[i] = y; + } + + return points; +} + +void ChartIntervalAxisY::updateGeometry() +{ + const QVector &layout = ChartAxis::layout(); + m_minWidth = 0; + m_minHeight = 0; + + if(layout.isEmpty()) return; + + QIntervalsAxis *intervalAxis = qobject_cast(m_chartAxis); + + QStringList ticksList = intervalAxis->intervalsLabels(); + + QList lines = m_grid->childItems(); + QList labels = m_labels->childItems(); + QList shades = m_shades->childItems(); + QList axis = m_axis->childItems(); + + // Q_ASSERT(labels.size() == ticksList.size()); + // Q_ASSERT(layout.size() == ticksList.size()); + + qreal height = 2*m_rect.bottom(); + + QGraphicsLineItem *lineItem = static_cast(axis.at(0)); + lineItem->setLine(m_rect.left() , m_rect.top(), m_rect.left(), m_rect.bottom()); + + for (int i = 0; i < layout.size(); ++i) { + QGraphicsLineItem *lineItem = static_cast(lines.at(i)); + lineItem->setLine(m_rect.left() , layout[i], m_rect.right(), layout[i]); + QGraphicsSimpleTextItem *labelItem = static_cast(labels.at(i)); + + if (i < ticksList.count()) { + labelItem->setText(ticksList.at(i)); + } + const QRectF& rect = labelItem->boundingRect(); + + QPointF center = rect.center(); + labelItem->setTransformOriginPoint(center.x(), center.y()); + + if (i < ticksList.count()) + labelItem->setPos(m_rect.left() - rect.width() - label_padding , layout[i] + (layout[i + 1] - layout[i]) / 2 - center.y()); +// labelItem->setPos(layout[i] + (layout[i + 1] - layout[i]) / 2 - center.x(), m_rect.bottom() + label_padding); + else + labelItem->setPos(m_rect.left() - rect.width() - label_padding , layout[i]-center.y()); + +// labelItem->setPos(m_rect.left() - rect.width() - label_padding , layout[i]-center.y()); + + if(labelItem->pos().y()+rect.height()>height) { + labelItem->setVisible(false); + lineItem->setVisible(false); + } + else { + labelItem->setVisible(true); + lineItem->setVisible(true); + height=labelItem->pos().y(); + } + + m_minWidth=qMax(rect.width()+label_padding,m_minWidth); + m_minHeight+=rect.height(); + + if ((i+1)%2 && i>1) { + QGraphicsRectItem *rectItem = static_cast(shades.at(i/2-1)); + rectItem->setRect(m_rect.left(),layout[i],m_rect.width(),layout[i-1]-layout[i]); + } + lineItem = static_cast(axis.at(i+1)); + lineItem->setLine(m_rect.left()-5,layout[i],m_rect.left(),layout[i]); + } +} + +QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/axis/intervalsaxis/chartintervalsaxisy_p.h b/src/axis/intervalsaxis/chartintervalsaxisy_p.h new file mode 100644 index 0000000..3053016 --- /dev/null +++ b/src/axis/intervalsaxis/chartintervalsaxisy_p.h @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the QtCommercial Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef CHARTINTERVALAXISY_H +#define CHARTINTERVALAXISY_H + +#include "chartaxis_p.h" + +QTCOMMERCIALCHART_BEGIN_NAMESPACE + +class QAbstractAxis; +class ChartPresenter; + +class ChartIntervalAxisY : public ChartAxis +{ +public: + ChartIntervalAxisY(QAbstractAxis *axis, ChartPresenter *presenter); + ~ChartIntervalAxisY(); + + AxisType axisType() const { return Y_AXIS;} + +protected: + QVector calculateLayout() const; + void updateGeometry(); +}; + +QTCOMMERCIALCHART_END_NAMESPACE + +#endif /* CHARTINTERVALAXISY_H */ diff --git a/src/axis/intervalsaxis/intervalsaxis.pri b/src/axis/intervalsaxis/intervalsaxis.pri index 66c2c0b..01ecf1e 100644 --- a/src/axis/intervalsaxis/intervalsaxis.pri +++ b/src/axis/intervalsaxis/intervalsaxis.pri @@ -2,11 +2,14 @@ INCLUDEPATH += $$PWD DEPENDPATH += $$PWD SOURCES += \ - $$PWD/qintervalsaxis.cpp - + $$PWD/chartintervalsaxisx.cpp \ + $$PWD/chartintervalsaxisy.cpp \ + $$PWD/qintervalsaxis.cpp PRIVATE_HEADERS += \ - $$PWD/qintervalaxis_p.h + $$PWD/chartintervalsaxisx_p.h \ + $$PWD/chartintervalsaxisy_p.h \ + $$PWD/qintervalsaxis_p.h PUBLIC_HEADERS += \ - $$PWD/qintervalaxis.h + $$PWD/qintervalsaxis.h diff --git a/src/axis/intervalsaxis/qintervalaxis.cpp b/src/axis/intervalsaxis/qintervalsaxis.cpp similarity index 61% rename from src/axis/intervalsaxis/qintervalaxis.cpp rename to src/axis/intervalsaxis/qintervalsaxis.cpp index 05ad6e4..52e1c53 100644 --- a/src/axis/intervalsaxis/qintervalaxis.cpp +++ b/src/axis/intervalsaxis/qintervalsaxis.cpp @@ -18,25 +18,25 @@ ** ****************************************************************************/ -#include "qintervalaxis.h" -#include "qintervalaxis_p.h" -#include "chartcategoriesaxisx_p.h" -#include "chartcategoriesaxisy_p.h" +#include "qintervalsaxis.h" +#include "qintervalsaxis_p.h" +#include "chartintervalsaxisx_p.h" +#include "chartintervalsaxisy_p.h" #include #include QTCOMMERCIALCHART_BEGIN_NAMESPACE /*! \internal - \class QIntervalAxis - \brief The QIntervalAxis class is used for manipulating chart's axis. + \class QIntervalsAxis + \brief The QIntervalsAxis class is used for manipulating chart's axis. \mainclass Axis can be setup to show axis line with tick marks, grid lines and shades. */ /*! - \qmlclass Axis QIntervalAxis + \qmlclass Axis QIntervalsAxis \brief The Axis element is used for manipulating chart's axes. Axis can be setup to show axis line with tick marks, grid lines and shades. @@ -50,22 +50,22 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE /*! Constructs an axis object which is a child of \a parent. */ -QIntervalAxis::QIntervalAxis(QObject *parent): - QValuesAxis(*new QIntervalAxisPrivate(this),parent) +QIntervalsAxis::QIntervalsAxis(QObject *parent): + QValuesAxis(*new QIntervalsAxisPrivate(this),parent) { } /*! Destroys the object */ -QIntervalAxis::~QIntervalAxis() +QIntervalsAxis::~QIntervalsAxis() { } /*! \internal */ -QIntervalAxis::QIntervalAxis(QIntervalAxisPrivate &d,QObject *parent):QValuesAxis(d,parent) +QIntervalsAxis::QIntervalsAxis(QIntervalsAxisPrivate &d,QObject *parent):QValuesAxis(d,parent) { } @@ -73,106 +73,118 @@ QIntervalAxis::QIntervalAxis(QIntervalAxisPrivate &d,QObject *parent):QValuesAxi /*! Appends \a category to axis */ -void QIntervalAxis::append(const QString& category, qreal x) +void QIntervalsAxis::append(const QString& intervalLabel, qreal interval) { - Q_D(QIntervalAxis); - if (!d->m_categories.contains(category)) + Q_D(QIntervalsAxis); + if (!d->m_intervals.contains(intervalLabel)) { - if(d->m_categories.isEmpty()){ - Range range(d->m_categoryMinimum,x); - d->m_categoriesMap.insert(category,range); - d->m_categories.append(category); + if(d->m_intervals.isEmpty()){ + Range range(d->m_categoryMinimum,interval); + d->m_intervalsMap.insert(intervalLabel, range); + d->m_intervals.append(intervalLabel); }else{ - Range range = d->m_categoriesMap.value(d->m_categories.last()); - d->m_categoriesMap.insert(category,Range(range.first,x)); - d->m_categories.append(category); + Range range = d->m_intervalsMap.value(d->m_intervals.last()); + d->m_intervalsMap.insert(intervalLabel, Range(range.second,interval)); + d->m_intervals.append(intervalLabel); } - setRange(d->m_min,x); + setRange(d->m_min,interval); } } -void QIntervalAxis::setFisrtCategoryMinimum(qreal x) +void QIntervalsAxis::setFisrtIntervalMinimum(qreal min) { - Q_D(QIntervalAxis); - if(d->m_categories.isEmpty()){ - d->m_categoryMinimum=x; + Q_D(QIntervalsAxis); + if(d->m_intervals.isEmpty()){ + d->m_categoryMinimum = min; }else{ - Range range = d->m_categoriesMap.value(d->m_categories.first()); - d->m_categoriesMap.insert(d->m_categories.first(),Range(x,range.second)); - setRange(x,d->m_min); + Range range = d->m_intervalsMap.value(d->m_intervals.first()); + d->m_intervalsMap.insert(d->m_intervals.first(), Range(min, range.second)); + setRange(min, d->m_min); } } +qreal QIntervalsAxis::intervalMin(const QString& intervalLabel) const +{ + Q_D(const QIntervalsAxis); + return d->m_intervalsMap.value(intervalLabel).first; +} + +qreal QIntervalsAxis::intervalMax(const QString& intervalLabel) const +{ + Q_D(const QIntervalsAxis); + return d->m_intervalsMap.value(intervalLabel).second; +} + /*! Removes \a category from axis */ -void QIntervalAxis::remove(const QString &category) +void QIntervalsAxis::remove(const QString &intervalLabel) { - Q_UNUSED(category); + Q_UNUSED(intervalLabel); //TODO } -QStringList QIntervalAxis::categories() +QStringList QIntervalsAxis::intervalsLabels() { - Q_D(QIntervalAxis); - return d->m_categories; + Q_D(QIntervalsAxis); + return d->m_intervals; } /*! Returns number of categories. */ -int QIntervalAxis::count() const +int QIntervalsAxis::count() const { - Q_D(const QIntervalAxis); - return d->m_categories.count(); + Q_D(const QIntervalsAxis); + return d->m_intervals.count(); } /*! Returns the type of the axis */ -QAbstractAxis::AxisType QIntervalAxis::type() const +QAbstractAxis::AxisType QIntervalsAxis::type() const { return AxisTypeCategories; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -QIntervalAxisPrivate::QIntervalAxisPrivate(QIntervalAxis* q): +QIntervalsAxisPrivate::QIntervalsAxisPrivate(QIntervalsAxis* q): QValuesAxisPrivate(q), m_categoryMinimum(0) { } -QIntervalAxisPrivate::~QIntervalAxisPrivate() +QIntervalsAxisPrivate::~QIntervalsAxisPrivate() { } -int QIntervalAxisPrivate::ticksCount() const +int QIntervalsAxisPrivate::ticksCount() const { - return m_categories.count()+1; + return m_intervals.count() + 1; } -void QIntervalAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count) +void QIntervalsAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count) { + Q_UNUSED(count); m_min = min; m_max = max; - m_ticksCount = count; +// m_ticksCount = count; } -ChartAxis* QIntervalAxisPrivate::createGraphics(ChartPresenter* presenter) +ChartAxis* QIntervalsAxisPrivate::createGraphics(ChartPresenter* presenter) { - Q_UNUSED(presenter); - // Q_Q( QCategoriesAxis); + Q_Q(QIntervalsAxis); if(m_orientation == Qt::Vertical){ - return 0; + return new ChartIntervalAxisY(q,presenter); }else{ - return 0; + return new ChartIntervalAxisX(q,presenter); } } -#include "moc_qintervalaxis.cpp" -#include "moc_qintervalaxis_p.cpp" +#include "moc_qintervalsaxis.cpp" +#include "moc_qintervalsaxis_p.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/axis/intervalsaxis/qintervalaxis.h b/src/axis/intervalsaxis/qintervalsaxis.h similarity index 72% rename from src/axis/intervalsaxis/qintervalaxis.h rename to src/axis/intervalsaxis/qintervalsaxis.h index 3ef9290..d9294f9 100644 --- a/src/axis/intervalsaxis/qintervalaxis.h +++ b/src/axis/intervalsaxis/qintervalsaxis.h @@ -26,37 +26,37 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE -class QIntervalAxisPrivate; +class QIntervalsAxisPrivate; -class QTCOMMERCIALCHART_EXPORT QIntervalAxis : public QValuesAxis +class QTCOMMERCIALCHART_EXPORT QIntervalsAxis : public QValuesAxis { Q_OBJECT public: - explicit QIntervalAxis(QObject *parent = 0); - ~QIntervalAxis(); + explicit QIntervalsAxis(QObject *parent = 0); + ~QIntervalsAxis(); protected: - QIntervalAxis(QIntervalAxisPrivate &d,QObject *parent = 0); + QIntervalsAxis(QIntervalsAxisPrivate &d,QObject *parent = 0); public: AxisType type() const; - void append(const QString& category, qreal interval = 1); - void remove(const QString& category); + void append(const QString& label, qreal interval = 1); + void remove(const QString& label); - void setFisrtCategoryMinimum(qreal x); + void setFisrtIntervalMinimum(qreal min); - qreal categoryMin(const QString& category) const; - qreal categoryMax(const QString& category) const; + qreal intervalMin(const QString& intervalLabel) const; + qreal intervalMax(const QString& intervalLabel) const; - QStringList categories(); + QStringList intervalsLabels(); int count() const; private: - Q_DECLARE_PRIVATE(QIntervalAxis) - Q_DISABLE_COPY(QIntervalAxis) + Q_DECLARE_PRIVATE(QIntervalsAxis) + Q_DISABLE_COPY(QIntervalsAxis) }; QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/axis/intervalsaxis/qintervalaxis_p.h b/src/axis/intervalsaxis/qintervalsaxis_p.h similarity index 83% rename from src/axis/intervalsaxis/qintervalaxis_p.h rename to src/axis/intervalsaxis/qintervalsaxis_p.h index 8c92b9b..e6f6cab 100644 --- a/src/axis/intervalsaxis/qintervalaxis_p.h +++ b/src/axis/intervalsaxis/qintervalsaxis_p.h @@ -27,24 +27,23 @@ // // We mean it. -#ifndef QINTERVALAXIS_P_H -#define QINTERVALAXIS_P_H +#ifndef QIntervalsAxis_P_H +#define QIntervalsAxis_P_H -#include "qintervalaxis.h" +#include "qintervalsaxis.h" #include "qvaluesaxis_p.h" QTCOMMERCIALCHART_BEGIN_NAMESPACE - typedef QPair Range; -class QIntervalAxisPrivate : public QValuesAxisPrivate +class QIntervalsAxisPrivate : public QValuesAxisPrivate { Q_OBJECT public: - QIntervalAxisPrivate(QIntervalAxis *q); - ~QIntervalAxisPrivate(); + QIntervalsAxisPrivate(QIntervalsAxis *q); + ~QIntervalsAxisPrivate(); public: @@ -58,12 +57,12 @@ public Q_SLOTS: void handleAxisRangeChanged(qreal min, qreal max,int count); private: - QMap m_categoriesMap; - QStringList m_categories; + QMap m_intervalsMap; + QStringList m_intervals; qreal m_categoryMinimum; private: - Q_DECLARE_PUBLIC(QIntervalAxis) + Q_DECLARE_PUBLIC(QIntervalsAxis) }; QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/axis/valuesaxis/qvaluesaxis_p.h b/src/axis/valuesaxis/qvaluesaxis_p.h index 8b7e71c..e23bf7a 100644 --- a/src/axis/valuesaxis/qvaluesaxis_p.h +++ b/src/axis/valuesaxis/qvaluesaxis_p.h @@ -59,7 +59,7 @@ private: void looseNiceNumbers(qreal &min, qreal &max, int &ticksCount) const; qreal niceNumber(qreal x,bool ceiling) const; -private: +protected: qreal m_min; qreal m_max; int m_tickCount;