diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2014-05-06 09:52:24 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2014-05-08 08:37:17 +0300 |
commit | 8ff45fe94c3f3f6916f8f673c3ce0b574a69cfdf (patch) | |
tree | 8a085097595201ad14a0afcdd794f75feb365e89 /src/datavisualization/axis | |
parent | d6c1aadb3ee366ce8fd40da43fb65128ab3b2d44 (diff) |
Value axis reversing support
Task-number: QTRD-2428
Change-Id: I51b3a1f8f974d5b72b36ee1188b7557539b9609b
Reviewed-by: Titta Heikkala <titta.heikkala@digia.com>
Reviewed-by: Mika Salmela <mika.salmela@digia.com>
Diffstat (limited to 'src/datavisualization/axis')
-rw-r--r-- | src/datavisualization/axis/qvalue3daxis.cpp | 33 | ||||
-rw-r--r-- | src/datavisualization/axis/qvalue3daxis.h | 5 | ||||
-rw-r--r-- | src/datavisualization/axis/qvalue3daxis_p.h | 1 |
3 files changed, 38 insertions, 1 deletions
diff --git a/src/datavisualization/axis/qvalue3daxis.cpp b/src/datavisualization/axis/qvalue3daxis.cpp index 79d374ea..1c7b647a 100644 --- a/src/datavisualization/axis/qvalue3daxis.cpp +++ b/src/datavisualization/axis/qvalue3daxis.cpp @@ -83,6 +83,15 @@ QT_BEGIN_NAMESPACE_DATAVISUALIZATION */ /*! + * \qmlproperty bool ValueAxis3D::reversed + * \since QtDataVisualization 1.1 + * + * If \c{true}, the axis will be rendered in reverse, i.e. the positions of minimum and maximum + * values are swapped when the graph is rendered. This property doesn't affect the actual + * minimum and maximum values of the axis. + */ + +/*! * Constructs QValue3DAxis with the given \a parent. */ QValue3DAxis::QValue3DAxis(QObject *parent) : @@ -204,6 +213,27 @@ QValue3DAxisFormatter *QValue3DAxis::formatter() const } /*! + * \property QValue3DAxis::reversed + * \since Qt Data Visualization 1.1 + * + * If \c{true}, the axis will be rendered in reverse, i.e. the positions of minimum and maximum + * values are swapped when the graph is rendered. This property doesn't affect the actual + * minimum and maximum values of the axis. + */ +void QValue3DAxis::setReversed(bool enable) +{ + if (dptr()->m_reversed != enable) { + dptr()->m_reversed = enable; + emit reversedChanged(enable); + } +} + +bool QValue3DAxis::reversed() const +{ + return dptrc()->m_reversed; +} + +/*! * \internal */ QValue3DAxisPrivate *QValue3DAxis::dptr() @@ -225,7 +255,8 @@ QValue3DAxisPrivate::QValue3DAxisPrivate(QValue3DAxis *q) m_subSegmentCount(1), m_labelFormat(Utils::defaultLabelFormat()), m_labelsDirty(true), - m_formatter(0) + m_formatter(0), + m_reversed(false) { } diff --git a/src/datavisualization/axis/qvalue3daxis.h b/src/datavisualization/axis/qvalue3daxis.h index 39a4a886..f552269c 100644 --- a/src/datavisualization/axis/qvalue3daxis.h +++ b/src/datavisualization/axis/qvalue3daxis.h @@ -33,6 +33,7 @@ class QT_DATAVISUALIZATION_EXPORT QValue3DAxis : public QAbstract3DAxis Q_PROPERTY(int subSegmentCount READ subSegmentCount WRITE setSubSegmentCount NOTIFY subSegmentCountChanged) Q_PROPERTY(QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged) Q_PROPERTY(QValue3DAxisFormatter* formatter READ formatter WRITE setFormatter NOTIFY formatterChanged REVISION 1) + Q_PROPERTY(bool reversed READ reversed WRITE setReversed NOTIFY reversedChanged REVISION 1) public: explicit QValue3DAxis(QObject *parent = 0); @@ -50,11 +51,15 @@ public: void setFormatter(QValue3DAxisFormatter *formatter); QValue3DAxisFormatter *formatter() const; + void setReversed(bool enable); + bool reversed() const; + signals: void segmentCountChanged(int count); void subSegmentCountChanged(int count); void labelFormatChanged(const QString &format); Q_REVISION(1) void formatterChanged(QValue3DAxisFormatter *formatter); + Q_REVISION(1) void reversedChanged(bool enable); protected: QValue3DAxisPrivate *dptr(); diff --git a/src/datavisualization/axis/qvalue3daxis_p.h b/src/datavisualization/axis/qvalue3daxis_p.h index eeccf527..47fd7e06 100644 --- a/src/datavisualization/axis/qvalue3daxis_p.h +++ b/src/datavisualization/axis/qvalue3daxis_p.h @@ -63,6 +63,7 @@ protected: QString m_labelFormat; bool m_labelsDirty; QValue3DAxisFormatter *m_formatter; + bool m_reversed; private: QValue3DAxis *qptr(); |