From 467e729eabece018cd42eeee0160f932983561b0 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 7 Jan 2014 13:11:34 +0200 Subject: Rename axis classes Moved the '3D' in axis class names so that the classes would be in line with other '3D' classes. Task-number: QTRD-2674 Change-Id: Ie4f8a10babe3bf1b0b30b366863f55ed02ec66ba Reviewed-by: Mika Salmela --- src/datavisualization/axis/axis.pri | 18 +- src/datavisualization/axis/q3dabstractaxis.cpp | 404 ------------------------- src/datavisualization/axis/q3dabstractaxis.h | 107 ------- src/datavisualization/axis/q3dabstractaxis_p.h | 77 ----- src/datavisualization/axis/q3dcategoryaxis.cpp | 156 ---------- src/datavisualization/axis/q3dcategoryaxis.h | 53 ---- src/datavisualization/axis/q3dcategoryaxis_p.h | 57 ---- src/datavisualization/axis/q3dvalueaxis.cpp | 270 ----------------- src/datavisualization/axis/q3dvalueaxis.h | 65 ---- src/datavisualization/axis/q3dvalueaxis_p.h | 66 ---- src/datavisualization/axis/qabstract3daxis.cpp | 404 +++++++++++++++++++++++++ src/datavisualization/axis/qabstract3daxis.h | 107 +++++++ src/datavisualization/axis/qabstract3daxis_p.h | 77 +++++ src/datavisualization/axis/qcategory3daxis.cpp | 156 ++++++++++ src/datavisualization/axis/qcategory3daxis.h | 53 ++++ src/datavisualization/axis/qcategory3daxis_p.h | 57 ++++ src/datavisualization/axis/qvalue3daxis.cpp | 270 +++++++++++++++++ src/datavisualization/axis/qvalue3daxis.h | 65 ++++ src/datavisualization/axis/qvalue3daxis_p.h | 66 ++++ 19 files changed, 1264 insertions(+), 1264 deletions(-) delete mode 100644 src/datavisualization/axis/q3dabstractaxis.cpp delete mode 100644 src/datavisualization/axis/q3dabstractaxis.h delete mode 100644 src/datavisualization/axis/q3dabstractaxis_p.h delete mode 100644 src/datavisualization/axis/q3dcategoryaxis.cpp delete mode 100644 src/datavisualization/axis/q3dcategoryaxis.h delete mode 100644 src/datavisualization/axis/q3dcategoryaxis_p.h delete mode 100644 src/datavisualization/axis/q3dvalueaxis.cpp delete mode 100644 src/datavisualization/axis/q3dvalueaxis.h delete mode 100644 src/datavisualization/axis/q3dvalueaxis_p.h create mode 100644 src/datavisualization/axis/qabstract3daxis.cpp create mode 100644 src/datavisualization/axis/qabstract3daxis.h create mode 100644 src/datavisualization/axis/qabstract3daxis_p.h create mode 100644 src/datavisualization/axis/qcategory3daxis.cpp create mode 100644 src/datavisualization/axis/qcategory3daxis.h create mode 100644 src/datavisualization/axis/qcategory3daxis_p.h create mode 100644 src/datavisualization/axis/qvalue3daxis.cpp create mode 100644 src/datavisualization/axis/qvalue3daxis.h create mode 100644 src/datavisualization/axis/qvalue3daxis_p.h (limited to 'src/datavisualization/axis') diff --git a/src/datavisualization/axis/axis.pri b/src/datavisualization/axis/axis.pri index 4e96618b..2c8bf70e 100644 --- a/src/datavisualization/axis/axis.pri +++ b/src/datavisualization/axis/axis.pri @@ -1,12 +1,12 @@ HEADERS += \ - $$PWD/q3dabstractaxis.h \ - $$PWD/q3dabstractaxis_p.h \ - $$PWD/q3dvalueaxis.h \ - $$PWD/q3dvalueaxis_p.h \ - $$PWD/q3dcategoryaxis.h \ - $$PWD/q3dcategoryaxis_p.h + $$PWD/qabstract3daxis.h \ + $$PWD/qabstract3daxis_p.h \ + $$PWD/qvalue3daxis.h \ + $$PWD/qvalue3daxis_p.h \ + $$PWD/qcategory3daxis.h \ + $$PWD/qcategory3daxis_p.h SOURCES += \ - $$PWD/q3dabstractaxis.cpp \ - $$PWD/q3dvalueaxis.cpp \ - $$PWD/q3dcategoryaxis.cpp + $$PWD/qabstract3daxis.cpp \ + $$PWD/qvalue3daxis.cpp \ + $$PWD/qcategory3daxis.cpp diff --git a/src/datavisualization/axis/q3dabstractaxis.cpp b/src/datavisualization/axis/q3dabstractaxis.cpp deleted file mode 100644 index 0b284947..00000000 --- a/src/datavisualization/axis/q3dabstractaxis.cpp +++ /dev/null @@ -1,404 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 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 QtDataVisualization module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 -** -****************************************************************************/ - -#include "q3dabstractaxis.h" -#include "q3dabstractaxis_p.h" - -QT_DATAVISUALIZATION_BEGIN_NAMESPACE - -/*! - * \class Q3DAbstractAxis - * \inmodule QtDataVisualization - * \brief Q3DAbstractAxis is base class for axes of a graph. - * \since Qt Data Visualization 1.0 - * - * You should not need to use this class directly, but one of its subclasses instead. - * - * \sa Q3DCategoryAxis, Q3DValueAxis - */ - -/*! - * \qmltype AbstractAxis3D - * \inqmlmodule QtDataVisualization - * \since QtDataVisualization 1.0 - * \ingroup datavisualization_qml - * \instantiates Q3DAbstractAxis - * \brief AbstractAxis3D is base type for axes of a graph. - * - * This type is uncreatable, but contains properties that are exposed via subtypes. - */ - -/*! - * \qmlproperty string AbstractAxis3D::title - * Defines the title for the axis. - */ - -/*! - * \qmlproperty list AbstractAxis3D::labels - * Defines the labels for the axis. - * \note Setting this property for ValueAxis3D does nothing, as it generates labels automatically. - */ - -/*! - * \qmlproperty AbstractAxis3D.AxisOrientation AbstractAxis3D::orientation - * Defines the orientation of the axis. - */ - -/*! - * \qmlproperty AbstractAxis3D.AxisType AbstractAxis3D::type - * Defines the type of the axis. - */ - -/*! - * \qmlproperty real AbstractAxis3D::min - * - * Defines the minimum value on the axis. - * When setting this property the max is adjusted if necessary, to ensure that the range remains - * valid. - */ - -/*! - * \qmlproperty real AbstractAxis3D::max - * - * Defines the maximum value on the axis. - * When setting this property the min is adjusted if necessary, to ensure that the range remains - * valid. - */ - -/*! - * \qmlproperty bool AbstractAxis3D::autoAdjustRange - * - * If set, the axis will automatically adjust the range so that all data fits in it. - */ - - -/*! - * \enum Q3DAbstractAxis::AxisOrientation - * - * The orientation of the axis object. - * - * \value AxisOrientationNone - * \value AxisOrientationX - * \value AxisOrientationY - * \value AxisOrientationZ - */ - -/*! - * \enum Q3DAbstractAxis::AxisType - * - * The type of the axis object. - * - * \value AxisTypeNone - * \value AxisTypeCategory - * \value AxisTypeValue - */ - -/*! - * \internal - */ -Q3DAbstractAxis::Q3DAbstractAxis(Q3DAbstractAxisPrivate *d, QObject *parent) : - QObject(parent), - d_ptr(d) -{ -} - -/*! - * Destroys Q3DAbstractAxis. - */ -Q3DAbstractAxis::~Q3DAbstractAxis() -{ -} - -/*! - * \property Q3DAbstractAxis::orientation - * - * Defines the orientation of the axis, one of \c Q3DAbstractAxis::AxisOrientation. - */ -Q3DAbstractAxis::AxisOrientation Q3DAbstractAxis::orientation() const -{ - return d_ptr->m_orientation; -} - -/*! - * \property Q3DAbstractAxis::type - * - * Defines the type of the axis, one of \c Q3DAbstractAxis::AxisType. - */ -Q3DAbstractAxis::AxisType Q3DAbstractAxis::type() const -{ - return d_ptr->m_type; -} - -/*! - * \property Q3DAbstractAxis::title - * - * Defines the title for the axis. - */ -void Q3DAbstractAxis::setTitle(QString title) -{ - if (d_ptr->m_title != title) { - d_ptr->m_title = title; - emit titleChanged(title); - } -} - -QString Q3DAbstractAxis::title() const -{ - return d_ptr->m_title; -} - -/*! - * \property Q3DAbstractAxis::labels - * - * Defines the labels for the axis. - * \note Setting this property for Q3DValueAxis does nothing, as it generates labels automatically. - */ -void Q3DAbstractAxis::setLabels(const QStringList &labels) -{ - Q_UNUSED(labels) -} - -QStringList Q3DAbstractAxis::labels() const -{ - d_ptr->updateLabels(); - return d_ptr->m_labels; -} - -/*! - * Sets value range of the axis from \a min to \a max. - * When setting the range, the max is adjusted if necessary, to ensure that the range remains valid. - * \note For Q3DCategoryAxis this specifies the index range of rows or columns to show. - */ -void Q3DAbstractAxis::setRange(float min, float max) -{ - d_ptr->setRange(min, max); - setAutoAdjustRange(false); -} - -/*! - * \property Q3DAbstractAxis::min - * - * Defines the minimum value on the axis. - * When setting this property the max is adjusted if necessary, to ensure that the range remains - * valid. - * \note For Q3DCategoryAxis this specifies the index of the first row or column to show. - */ -void Q3DAbstractAxis::setMin(float min) -{ - d_ptr->setMin(min); - setAutoAdjustRange(false); -} - -/*! - * \property Q3DAbstractAxis::max - * - * Defines the maximum value on the axis. - * When setting this property the min is adjusted if necessary, to ensure that the range remains - * valid. - * \note For Q3DCategoryAxis this specifies the index of the last row or column to show. - */ -void Q3DAbstractAxis::setMax(float max) -{ - d_ptr->setMax(max); - setAutoAdjustRange(false); -} - -float Q3DAbstractAxis::min() const -{ - return d_ptr->m_min; -} - -float Q3DAbstractAxis::max() const -{ - return d_ptr->m_max; -} - -/*! - * \property Q3DAbstractAxis::autoAdjustRange - * - * If set, the axis will automatically adjust the range so that all data fits in it. - * - * \sa setRange(), setMin(), setMax() - */ -void Q3DAbstractAxis::setAutoAdjustRange(bool autoAdjust) -{ - if (d_ptr->m_autoAdjust != autoAdjust) { - d_ptr->m_autoAdjust = autoAdjust; - emit autoAdjustRangeChanged(autoAdjust); - } -} - -bool Q3DAbstractAxis::isAutoAdjustRange() const -{ - return d_ptr->m_autoAdjust; -} - -/*! - * \fn Q3DAbstractAxis::rangeChanged(float min, float max) - * - * Emits range \a min and \a max values when range changes. - */ - -// Q3DAbstractAxisPrivate - -Q3DAbstractAxisPrivate::Q3DAbstractAxisPrivate(Q3DAbstractAxis *q, Q3DAbstractAxis::AxisType type) - : QObject(0), - q_ptr(q), - m_orientation(Q3DAbstractAxis::AxisOrientationNone), - m_type(type), - m_isDefaultAxis(false), - m_min(0.0f), - m_max(10.0f), - m_autoAdjust(true), - m_onlyPositiveValues(false), - m_allowMinMaxSame(false) -{ -} - -Q3DAbstractAxisPrivate::~Q3DAbstractAxisPrivate() -{ -} - -void Q3DAbstractAxisPrivate::setOrientation(Q3DAbstractAxis::AxisOrientation orientation) -{ - if (m_orientation == Q3DAbstractAxis::AxisOrientationNone) { - m_orientation = orientation; - emit q_ptr->orientationChanged(orientation); - } else { - Q_ASSERT("Attempted to reset axis orientation."); - } -} - -void Q3DAbstractAxisPrivate::updateLabels() -{ - // Default implementation does nothing -} - -void Q3DAbstractAxisPrivate::setRange(float min, float max) -{ - bool adjusted = false; - if (m_onlyPositiveValues) { - if (min < 0.0f) { - min = 0.0f; - adjusted = true; - } - if (max < 0.0f) { - max = 0.0f; - adjusted = true; - } - } - // If min >= max, we adjust ranges so that - // m_max becomes (min + 1.0f) - // as axes need some kind of valid range. - bool minDirty = false; - bool maxDirty = false; - if (m_min != min) { - m_min = min; - minDirty = true; - } - if (m_max != max || min > max || (!m_allowMinMaxSame && min == max)) { - if (min > max || (!m_allowMinMaxSame && min == max)) { - m_max = min + 1.0f; - adjusted = true; - } else { - m_max = max; - } - maxDirty = true; - } - - if (minDirty || maxDirty) { - if (adjusted) { - qWarning() << "Warning: Tried to set invalid range for axis." - " Range automatically adjusted to a valid one:" - << min << "-" << max << "-->" << m_min << "-" << m_max; - } - emit q_ptr->rangeChanged(m_min, m_max); - } - - if (minDirty) - emit q_ptr->minChanged(m_min); - if (maxDirty) - emit q_ptr->maxChanged(m_max); -} - -void Q3DAbstractAxisPrivate::setMin(float min) -{ - if (m_onlyPositiveValues) { - if (min < 0.0f) { - min = 0.0f; - qWarning() << "Warning: Tried to set negative minimum for an axis that only supports" - " positive values:" << min; - } - } - - if (m_min != min) { - bool maxChanged = false; - if (min > m_max || (!m_allowMinMaxSame && min == m_max)) { - float oldMax = m_max; - m_max = min + 1.0f; - qWarning() << "Warning: Tried to set minimum to equal or larger than maximum for" - " value axis. Maximum automatically adjusted to a valid one:" - << oldMax << "-->" << m_max; - maxChanged = true; - } - m_min = min; - - emit q_ptr->rangeChanged(m_min, m_max); - emit q_ptr->minChanged(m_min); - if (maxChanged) - emit q_ptr->maxChanged(m_max); - } -} - -void Q3DAbstractAxisPrivate::setMax(float max) -{ - if (m_onlyPositiveValues) { - if (max < 0.0f) { - max = 0.0f; - qWarning() << "Warning: Tried to set negative maximum for an axis that only supports" - " positive values:" << max; - } - } - - if (m_max != max) { - bool minChanged = false; - if (m_min > max || (!m_allowMinMaxSame && m_min == max)) { - float oldMin = m_min; - m_min = max - 1.0f; - if (m_onlyPositiveValues && m_min < 0.0f) { - m_min = 0.0f; - if (!m_allowMinMaxSame && max == 0.0f) { - m_min = oldMin; - qWarning() << "Unable to set maximum value to zero."; - return; - } - } - qWarning() << "Warning: Tried to set maximum to equal or smaller than minimum for" - " value axis. Minimum automatically adjusted to a valid one:" - << oldMin << "-->" << m_min; - minChanged = true; - } - m_max = max; - emit q_ptr->rangeChanged(m_min, m_max); - emit q_ptr->maxChanged(m_max); - if (minChanged) - emit q_ptr->minChanged(m_min); - } -} - -QT_DATAVISUALIZATION_END_NAMESPACE diff --git a/src/datavisualization/axis/q3dabstractaxis.h b/src/datavisualization/axis/q3dabstractaxis.h deleted file mode 100644 index 825290f5..00000000 --- a/src/datavisualization/axis/q3dabstractaxis.h +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 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 QtDataVisualization module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 -** -****************************************************************************/ - -#ifndef Q3DABSTRACTAXIS_H -#define Q3DABSTRACTAXIS_H - -#include -#include -#include -#include -#include - -QT_DATAVISUALIZATION_BEGIN_NAMESPACE - -class Q3DAbstractAxisPrivate; - -class QT_DATAVISUALIZATION_EXPORT Q3DAbstractAxis : public QObject -{ - Q_OBJECT - Q_ENUMS(AxisOrientation) - Q_ENUMS(AxisType) - Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged) - Q_PROPERTY(QStringList labels READ labels WRITE setLabels NOTIFY labelsChanged) - Q_PROPERTY(AxisOrientation orientation READ orientation NOTIFY orientationChanged) - Q_PROPERTY(AxisType type READ type CONSTANT) - Q_PROPERTY(float min READ min WRITE setMin NOTIFY minChanged) - Q_PROPERTY(float max READ max WRITE setMax NOTIFY maxChanged) - Q_PROPERTY(bool autoAdjustRange READ isAutoAdjustRange WRITE setAutoAdjustRange NOTIFY autoAdjustRangeChanged) - -public: - enum AxisOrientation { - AxisOrientationNone = 0, - AxisOrientationX = 1, - AxisOrientationY = 2, - AxisOrientationZ = 4 - }; - - enum AxisType { - AxisTypeNone = 0, - AxisTypeCategory = 1, - AxisTypeValue = 2 - //AxisTypeLogValue = 6 // inherits valueaxis (4 + 2) // TODO - }; - -protected: - explicit Q3DAbstractAxis(Q3DAbstractAxisPrivate *d, QObject *parent = 0); - -public: - virtual ~Q3DAbstractAxis(); - - void setTitle(QString title); - QString title() const; - - void setLabels(const QStringList &labels); - QStringList labels() const; - - AxisOrientation orientation() const; - AxisType type() const; - - void setMin(float min); - float min() const; - - void setMax(float max); - float max() const; - - void setAutoAdjustRange(bool autoAdjust); - bool isAutoAdjustRange() const; - - void setRange(float min, float max); - -signals: - void titleChanged(QString newTitle); - void labelsChanged(); - void orientationChanged(AxisOrientation orientation); - void minChanged(float value); - void maxChanged(float value); - void rangeChanged(float min, float max); - void autoAdjustRangeChanged(bool autoAdjust); - -protected: - QScopedPointer d_ptr; - -private: - Q_DISABLE_COPY(Q3DAbstractAxis) - - friend class Abstract3DController; - friend class Bars3DController; -}; - -QT_DATAVISUALIZATION_END_NAMESPACE - -#endif // QABSTRACTAXIS_H diff --git a/src/datavisualization/axis/q3dabstractaxis_p.h b/src/datavisualization/axis/q3dabstractaxis_p.h deleted file mode 100644 index 3293e41e..00000000 --- a/src/datavisualization/axis/q3dabstractaxis_p.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 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 QtDataVisualization module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVisualization 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. - -#include "datavisualizationglobal_p.h" -#include "q3dabstractaxis.h" -#include "abstract3dcontroller_p.h" - -#ifndef Q3DABSTRACTAXIS_P_H -#define Q3DABSTRACTAXIS_P_H - -QT_DATAVISUALIZATION_BEGIN_NAMESPACE - -class Q3DAbstractAxisPrivate : public QObject -{ - Q_OBJECT -public: - Q3DAbstractAxisPrivate(Q3DAbstractAxis *q, Q3DAbstractAxis::AxisType type); - virtual ~Q3DAbstractAxisPrivate(); - - void setOrientation(Q3DAbstractAxis::AxisOrientation orientation); - - inline bool isDefaultAxis() { return m_isDefaultAxis; } - inline void setDefaultAxis(bool isDefault) { m_isDefaultAxis = isDefault; } - - virtual void setRange(float min, float max); - virtual void setMin(float min); - virtual void setMax (float max); - -protected: - virtual void updateLabels(); - - Q3DAbstractAxis *q_ptr; - - QString m_title; - QStringList m_labels; - Q3DAbstractAxis::AxisOrientation m_orientation; - Q3DAbstractAxis::AxisType m_type; - bool m_isDefaultAxis; - float m_min; - float m_max; - bool m_autoAdjust; - bool m_onlyPositiveValues; - bool m_allowMinMaxSame; - - friend class Q3DAbstractAxis; - friend class Q3DValueAxis; - friend class Q3DCategoryAxis; -}; - -QT_DATAVISUALIZATION_END_NAMESPACE - -#endif // QABSTRACTAXIS_P_H diff --git a/src/datavisualization/axis/q3dcategoryaxis.cpp b/src/datavisualization/axis/q3dcategoryaxis.cpp deleted file mode 100644 index 26a75f93..00000000 --- a/src/datavisualization/axis/q3dcategoryaxis.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 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 QtDataVisualization module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 -** -****************************************************************************/ - -#include "q3dcategoryaxis.h" -#include "q3dcategoryaxis_p.h" -#include "bars3dcontroller_p.h" -#include "qbardataproxy.h" - -QT_DATAVISUALIZATION_BEGIN_NAMESPACE - -/*! - * \class Q3DCategoryAxis - * \inmodule QtDataVisualization - * \brief The Q3DCategoryAxis class is used for manipulating an axis of a graph. - * \since Qt Data Visualization 1.0 - * - * Q3DCategoryAxis provides an axis that can be given labels. The axis is divided into equal-sized - * categories based on the data window size defined by setting the axis range. - * - * Grid lines are drawn between categories, if visible. Labels are drawn to positions of categories - * if provided. - */ - -/*! - * \qmltype CategoryAxis3D - * \inqmlmodule QtDataVisualization - * \since QtDataVisualization 1.0 - * \ingroup datavisualization_qml - * \instantiates Q3DCategoryAxis - * \inherits AbstractAxis3D - * \brief The CategoryAxis3D type is used for manipulating an axis of a graph. - * - * This type provides an axis that can be given labels. - */ - -/*! - * \qmlproperty list CategoryAxis3D::labels - * - * Defines labels for axis applied to categories. If there are fewer labels than categories, the - * remaining ones do not have a label. If category labels are not defined explicitly, labels are - * generated from the data row (or column) labels. - * - * \note If the graph has multiple visible series and category labels are not defined explicitly, - * changing the rows (or columns) on any of the attached series will regenerate the labels. - */ - -/*! - * Constructs Q3DCategoryAxis with \a parent. - */ -Q3DCategoryAxis::Q3DCategoryAxis(QObject *parent) : - Q3DAbstractAxis(new Q3DCategoryAxisPrivate(this), parent) -{ - connect(this, &Q3DCategoryAxis::labelsChanged, this, &Q3DAbstractAxis::labelsChanged); -} - -/*! - * Destroys Q3DCategoryAxis. - */ -Q3DCategoryAxis::~Q3DCategoryAxis() -{ -} - -/*! - * \property Q3DCategoryAxis::labels - * - * Defines labels for axis applied to categories. If there are fewer labels than categories, the - * remaining ones do not have a label. If category labels are not defined explicitly, labels are - * generated from the data row (or column) labels. - * - * \note If the graph has multiple visible series and category labels are not defined explicitly, - * changing the rows (or columns) on any of the attached series will regenerate the labels. - */ -QStringList Q3DCategoryAxis::labels() const -{ - return Q3DAbstractAxis::labels(); -} - -void Q3DCategoryAxis::setLabels(const QStringList &labels) -{ - dptr()->m_labelsExplicitlySet = !labels.isEmpty(); - bool labelsFromData = false; - - // Get labels from data proxy if axis is attached to a bar controller and an active axis there - if (labels.isEmpty()) { - Bars3DController *controller = qobject_cast(parent()); - if (controller) { - if (controller->axisX() == this) { - controller->handleDataRowLabelsChanged(); - labelsFromData = true; - } else if (controller->axisZ() == this) { - controller->handleDataColumnLabelsChanged(); - labelsFromData = true; - } - } - } - - if (!labelsFromData && d_ptr->m_labels != labels) { - d_ptr->m_labels = labels; - emit labelsChanged(); - } -} - -/*! - * \internal - */ -Q3DCategoryAxisPrivate *Q3DCategoryAxis::dptr() -{ - return static_cast(d_ptr.data()); -} - -Q3DCategoryAxisPrivate::Q3DCategoryAxisPrivate(Q3DCategoryAxis *q) - : Q3DAbstractAxisPrivate(q, Q3DAbstractAxis::AxisTypeCategory), - m_labelsExplicitlySet(false) -{ - m_onlyPositiveValues = true; - m_allowMinMaxSame = true; -} - -Q3DCategoryAxisPrivate::~Q3DCategoryAxisPrivate() -{ -} - -/*! - * \internal - * Controller uses this function to set labels from data proxy as category labels. - * If the labels have been set explicitly by the user, data proxy labels are not used. - */ -void Q3DCategoryAxisPrivate::setDataLabels(const QStringList &labels) -{ - if (!m_labelsExplicitlySet && m_labels != labels) { - m_labels = labels; - emit qptr()->labelsChanged(); - } -} - -Q3DCategoryAxis *Q3DCategoryAxisPrivate::qptr() -{ - return static_cast(q_ptr); -} - -QT_DATAVISUALIZATION_END_NAMESPACE diff --git a/src/datavisualization/axis/q3dcategoryaxis.h b/src/datavisualization/axis/q3dcategoryaxis.h deleted file mode 100644 index 7b2b4744..00000000 --- a/src/datavisualization/axis/q3dcategoryaxis.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 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 QtDataVisualization module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 -** -****************************************************************************/ - -#ifndef Q3DCATEGORYAXIS_H -#define Q3DCATEGORYAXIS_H - -#include - -QT_DATAVISUALIZATION_BEGIN_NAMESPACE - -class Q3DCategoryAxisPrivate; - -class QT_DATAVISUALIZATION_EXPORT Q3DCategoryAxis : public Q3DAbstractAxis -{ - Q_OBJECT - Q_PROPERTY(QStringList labels READ labels WRITE setLabels NOTIFY labelsChanged) - -public: - explicit Q3DCategoryAxis(QObject *parent = 0); - virtual ~Q3DCategoryAxis(); - - void setLabels(const QStringList &labels); - QStringList labels() const; - -signals: - void labelsChanged(); - -protected: - Q3DCategoryAxisPrivate *dptr(); - -private: - Q_DISABLE_COPY(Q3DCategoryAxis) - friend class Bars3DController; -}; - -QT_DATAVISUALIZATION_END_NAMESPACE - -#endif // QCATEGORYAXIS_H diff --git a/src/datavisualization/axis/q3dcategoryaxis_p.h b/src/datavisualization/axis/q3dcategoryaxis_p.h deleted file mode 100644 index 9b66e48a..00000000 --- a/src/datavisualization/axis/q3dcategoryaxis_p.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 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 QtDataVisualization module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVisualization 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. - -#include "q3dcategoryaxis.h" -#include "q3dabstractaxis_p.h" -#include "qbardataitem.h" - -#ifndef QCATEGORYAXIS_P_H -#define QCATEGORYAXIS_P_H - -QT_DATAVISUALIZATION_BEGIN_NAMESPACE - -class Q3DCategoryAxisPrivate : public Q3DAbstractAxisPrivate -{ - Q_OBJECT - -public: - Q3DCategoryAxisPrivate(Q3DCategoryAxis *q); - virtual ~Q3DCategoryAxisPrivate(); - - void setDataLabels(const QStringList &labels); - -private: - Q3DCategoryAxis *qptr(); - - bool m_labelsExplicitlySet; - friend class Q3DCategoryAxis; -}; - -QT_DATAVISUALIZATION_END_NAMESPACE - -#endif // QCATEGORYAXIS_P_H diff --git a/src/datavisualization/axis/q3dvalueaxis.cpp b/src/datavisualization/axis/q3dvalueaxis.cpp deleted file mode 100644 index 746c8617..00000000 --- a/src/datavisualization/axis/q3dvalueaxis.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 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 QtDataVisualization module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 -** -****************************************************************************/ - -#include "q3dvalueaxis.h" -#include "q3dvalueaxis_p.h" -#include "utils_p.h" - -QT_DATAVISUALIZATION_BEGIN_NAMESPACE - -/*! - * \class Q3DValueAxis - * \inmodule QtDataVisualization - * \brief The Q3DValueAxis class is used for manipulating an axis of a graph. - * \since Qt Data Visualization 1.0 - * - * Q3DValueAxis provides an axis that can be given a range of values and segment and subsegment - * counts to divide the range into. - * - * Labels are drawn between each segment. Grid lines are drawn between each segment and each - * subsegment. \note If visible, there will always be at least two grid lines and labels indicating - * the minimum and the maximum values of the range, as there is always at least one segment. - */ - -/*! - * \qmltype ValueAxis3D - * \inqmlmodule QtDataVisualization - * \since QtDataVisualization 1.0 - * \ingroup datavisualization_qml - * \instantiates Q3DValueAxis - * \inherits AbstractAxis3D - * \brief The ValueAxis3D type is used for manipulating an axis of a graph. - * - * This type provides an axis that can be given a range of values and segment and subsegment - * counts to divide the range into. - */ - - -/*! - * \qmlproperty int ValueAxis3D::segmentCount - * - * Defines the number of segments on the axis. This indicates how many labels are drawn. The number - * of grid lines to be drawn is calculated with formula: \c {segments * subsegments + 1}. - * The preset default is \c 5, and it can not be below \c 1. - */ - -/*! - * \qmlproperty int ValueAxis3D::subSegmentCount - * - * Defines the number of subsegments inside each segment on the axis. Grid lines are drawn between - * each subsegment, in addition to each segment. - * The preset default is \c 1, and it can not be below \c 1. - */ - -/*! - * \qmlproperty string ValueAxis3D::labelFormat - * - * Defines the label format to be used for the labels on this axis. Supported specifiers are: - * \c {d, i, o, x, X, f, F, e, E, g, G, c}. See QString::sprintf() for additional details. - */ - -/*! - * Constructs Q3DValueAxis with the given \a parent. - */ -Q3DValueAxis::Q3DValueAxis(QObject *parent) : - Q3DAbstractAxis(new Q3DValueAxisPrivate(this), parent) -{ -} - -/*! - * Destroys Q3DValueAxis. - */ -Q3DValueAxis::~Q3DValueAxis() -{ -} - - -/*! - * \property Q3DValueAxis::segmentCount - * - * Defines the number of segments on the axis. This indicates how many labels are drawn. The number - * of grid lines to be drawn is calculated with formula: \c {segments * subsegments + 1}. - * The preset default is \c 5, and it can not be below \c 1. - * - * \sa setSubSegmentCount() - */ -void Q3DValueAxis::setSegmentCount(int count) -{ - if (count <= 0) { - qWarning() << "Warning: Illegal segment count automatically adjusted to a legal one:" - << count << "-> 1"; - count = 1; - } - if (dptr()->m_segmentCount != count){ - dptr()->m_segmentCount = count; - dptr()->emitLabelsChanged(); - emit segmentCountChanged(count); - } -} - -int Q3DValueAxis::segmentCount() const -{ - return dptrc()->m_segmentCount; -} - -/*! - * \property Q3DValueAxis::subSegmentCount - * - * Defines the number of subsegments inside each segment on the axis. Grid lines are drawn between - * each subsegment, in addition to each segment. - * The preset default is \c 1, and it can not be below \c 1. - * - * \sa setSegmentCount() - */ -void Q3DValueAxis::setSubSegmentCount(int count) -{ - if (count <= 0) { - qWarning() << "Warning: Illegal subsegment count automatically adjusted to a legal one:" - << count << "-> 1"; - count = 1; - } - if (dptr()->m_subSegmentCount != count) { - dptr()->m_subSegmentCount = count; - emit subSegmentCountChanged(count); - } -} - -int Q3DValueAxis::subSegmentCount() const -{ - return dptrc()->m_subSegmentCount; -} - -/*! - * \property Q3DValueAxis::labelFormat - * - * Defines the label format to be used for the labels on this axis. Supported specifiers are: - * \c {d, i, o, x, X, f, F, e, E, g, G, c}. See QString::sprintf() for additional details. - * - * Usage example: - * - * \c {axis->setLabelFormat("%.2f mm");} - */ -void Q3DValueAxis::setLabelFormat(const QString &format) -{ - if (dptr()->m_labelFormat != format) { - dptr()->m_labelFormat = format; - dptr()->emitLabelsChanged(); - emit labelFormatChanged(format); - } -} - -QString Q3DValueAxis::labelFormat() const -{ - return dptrc()->m_labelFormat; -} - -/*! - * \internal - */ -Q3DValueAxisPrivate *Q3DValueAxis::dptr() -{ - return static_cast(d_ptr.data()); -} - -/*! - * \internal - */ -const Q3DValueAxisPrivate *Q3DValueAxis::dptrc() const -{ - return static_cast(d_ptr.data()); -} - -Q3DValueAxisPrivate::Q3DValueAxisPrivate(Q3DValueAxis *q) - : Q3DAbstractAxisPrivate(q, Q3DAbstractAxis::AxisTypeValue), - m_segmentCount(5), - m_subSegmentCount(1), - m_labelFormat(Utils::defaultLabelFormat()), - m_labelsDirty(true) -{ -} - -Q3DValueAxisPrivate::~Q3DValueAxisPrivate() -{ -} - -void Q3DValueAxisPrivate::setRange(float min, float max) -{ - bool dirty = (min != m_min || max != m_max); - - Q3DAbstractAxisPrivate::setRange(min, max); - - if (dirty) - emitLabelsChanged(); -} - -void Q3DValueAxisPrivate::setMin(float min) -{ - bool dirty = (min != m_min); - - Q3DAbstractAxisPrivate::setMin(min); - - if (dirty) - emitLabelsChanged(); -} - -void Q3DValueAxisPrivate::setMax(float max) -{ - bool dirty = (max != m_max); - - Q3DAbstractAxisPrivate::setMax(max); - - if (dirty) - emitLabelsChanged(); -} - -void Q3DValueAxisPrivate::emitLabelsChanged() -{ - m_labelsDirty = true; - emit q_ptr->labelsChanged(); -} - -void Q3DValueAxisPrivate::updateLabels() -{ - if (!m_labelsDirty) - return; - - m_labelsDirty = false; - - QStringList newLabels; - newLabels.reserve(m_segmentCount + 1); - - // First label is at axis min, which is an extra segment - float segmentStep = (m_max - m_min) / m_segmentCount; - - QString formatString(m_labelFormat); - Utils::ParamType paramType = Utils::findFormatParamType(formatString); - QByteArray formatArray = formatString.toUtf8(); - - for (int i = 0; i < m_segmentCount; i++) { - float value = m_min + (segmentStep * i); - newLabels.append(Utils::formatLabel(formatArray, paramType, value)); - } - - // Ensure max label doesn't suffer from any rounding errors - newLabels.append(Utils::formatLabel(formatArray, paramType, m_max)); - - if (m_labels != newLabels) - m_labels = newLabels; -} - -Q3DValueAxis *Q3DValueAxisPrivate::qptr() -{ - return static_cast(q_ptr); -} - -QT_DATAVISUALIZATION_END_NAMESPACE diff --git a/src/datavisualization/axis/q3dvalueaxis.h b/src/datavisualization/axis/q3dvalueaxis.h deleted file mode 100644 index f1280e25..00000000 --- a/src/datavisualization/axis/q3dvalueaxis.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 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 QtDataVisualization module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 -** -****************************************************************************/ - -#ifndef QVALUEAXIS_H -#define QVALUEAXIS_H - -#include - -QT_DATAVISUALIZATION_BEGIN_NAMESPACE - -class Q3DValueAxisPrivate; - -class QT_DATAVISUALIZATION_EXPORT Q3DValueAxis : public Q3DAbstractAxis -{ - Q_OBJECT - Q_PROPERTY(int segmentCount READ segmentCount WRITE setSegmentCount NOTIFY segmentCountChanged) - Q_PROPERTY(int subSegmentCount READ subSegmentCount WRITE setSubSegmentCount NOTIFY subSegmentCountChanged) - Q_PROPERTY(QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged) - -public: - explicit Q3DValueAxis(QObject *parent = 0); - virtual ~Q3DValueAxis(); - - int segmentCount() const; - int subSegmentCount() const; - QString labelFormat() const; - - void setSegmentCount(int count); - void setSubSegmentCount(int count); - void setLabelFormat(const QString &format); - -signals: - void segmentCountChanged(int count); - void subSegmentCountChanged(int count); - void labelFormatChanged(QString format); - -protected: - Q3DValueAxisPrivate *dptr(); - const Q3DValueAxisPrivate *dptrc() const; - -private: - Q_DISABLE_COPY(Q3DValueAxis) - friend class Bars3DController; - friend class Scatter3DController; - friend class Surface3DController; -}; - -QT_DATAVISUALIZATION_END_NAMESPACE - -#endif // QVALUEAXIS_H diff --git a/src/datavisualization/axis/q3dvalueaxis_p.h b/src/datavisualization/axis/q3dvalueaxis_p.h deleted file mode 100644 index 0a98bb04..00000000 --- a/src/datavisualization/axis/q3dvalueaxis_p.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 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 QtDataVisualization module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVisualization 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. - -#include "q3dvalueaxis.h" -#include "q3dabstractaxis_p.h" - -#ifndef QVALUEAXIS_P_H -#define QVALUEAXIS_P_H - -QT_DATAVISUALIZATION_BEGIN_NAMESPACE - -class Q3DValueAxisPrivate : public Q3DAbstractAxisPrivate -{ - Q_OBJECT - -public: - Q3DValueAxisPrivate(Q3DValueAxis *q); - virtual ~Q3DValueAxisPrivate(); - - virtual void setRange(float min, float max); - virtual void setMin(float min); - virtual void setMax (float max); - -protected: - void emitLabelsChanged(); - virtual void updateLabels(); - - int m_segmentCount; - int m_subSegmentCount; - QString m_labelFormat; - bool m_labelsDirty; - -private: - Q3DValueAxis *qptr(); - - friend class Q3DValueAxis; -}; - -QT_DATAVISUALIZATION_END_NAMESPACE - -#endif // QVALUEAXIS_P_H diff --git a/src/datavisualization/axis/qabstract3daxis.cpp b/src/datavisualization/axis/qabstract3daxis.cpp new file mode 100644 index 00000000..5f1121c4 --- /dev/null +++ b/src/datavisualization/axis/qabstract3daxis.cpp @@ -0,0 +1,404 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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 QtDataVisualization module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 +** +****************************************************************************/ + +#include "qabstract3daxis.h" +#include "qabstract3daxis_p.h" + +QT_DATAVISUALIZATION_BEGIN_NAMESPACE + +/*! + * \class QAbstract3DAxis + * \inmodule QtDataVisualization + * \brief QAbstract3DAxis is base class for axes of a graph. + * \since Qt Data Visualization 1.0 + * + * You should not need to use this class directly, but one of its subclasses instead. + * + * \sa QCategory3DAxis, QValue3DAxis + */ + +/*! + * \qmltype AbstractAxis3D + * \inqmlmodule QtDataVisualization + * \since QtDataVisualization 1.0 + * \ingroup datavisualization_qml + * \instantiates QAbstract3DAxis + * \brief AbstractAxis3D is base type for axes of a graph. + * + * This type is uncreatable, but contains properties that are exposed via subtypes. + */ + +/*! + * \qmlproperty string AbstractAxis3D::title + * Defines the title for the axis. + */ + +/*! + * \qmlproperty list AbstractAxis3D::labels + * Defines the labels for the axis. + * \note Setting this property for ValueAxis3D does nothing, as it generates labels automatically. + */ + +/*! + * \qmlproperty AbstractAxis3D.AxisOrientation AbstractAxis3D::orientation + * Defines the orientation of the axis. + */ + +/*! + * \qmlproperty AbstractAxis3D.AxisType AbstractAxis3D::type + * Defines the type of the axis. + */ + +/*! + * \qmlproperty real AbstractAxis3D::min + * + * Defines the minimum value on the axis. + * When setting this property the max is adjusted if necessary, to ensure that the range remains + * valid. + */ + +/*! + * \qmlproperty real AbstractAxis3D::max + * + * Defines the maximum value on the axis. + * When setting this property the min is adjusted if necessary, to ensure that the range remains + * valid. + */ + +/*! + * \qmlproperty bool AbstractAxis3D::autoAdjustRange + * + * If set, the axis will automatically adjust the range so that all data fits in it. + */ + + +/*! + * \enum QAbstract3DAxis::AxisOrientation + * + * The orientation of the axis object. + * + * \value AxisOrientationNone + * \value AxisOrientationX + * \value AxisOrientationY + * \value AxisOrientationZ + */ + +/*! + * \enum QAbstract3DAxis::AxisType + * + * The type of the axis object. + * + * \value AxisTypeNone + * \value AxisTypeCategory + * \value AxisTypeValue + */ + +/*! + * \internal + */ +QAbstract3DAxis::QAbstract3DAxis(QAbstract3DAxisPrivate *d, QObject *parent) : + QObject(parent), + d_ptr(d) +{ +} + +/*! + * Destroys QAbstract3DAxis. + */ +QAbstract3DAxis::~QAbstract3DAxis() +{ +} + +/*! + * \property QAbstract3DAxis::orientation + * + * Defines the orientation of the axis, one of \c QAbstract3DAxis::AxisOrientation. + */ +QAbstract3DAxis::AxisOrientation QAbstract3DAxis::orientation() const +{ + return d_ptr->m_orientation; +} + +/*! + * \property QAbstract3DAxis::type + * + * Defines the type of the axis, one of \c QAbstract3DAxis::AxisType. + */ +QAbstract3DAxis::AxisType QAbstract3DAxis::type() const +{ + return d_ptr->m_type; +} + +/*! + * \property QAbstract3DAxis::title + * + * Defines the title for the axis. + */ +void QAbstract3DAxis::setTitle(QString title) +{ + if (d_ptr->m_title != title) { + d_ptr->m_title = title; + emit titleChanged(title); + } +} + +QString QAbstract3DAxis::title() const +{ + return d_ptr->m_title; +} + +/*! + * \property QAbstract3DAxis::labels + * + * Defines the labels for the axis. + * \note Setting this property for QValue3DAxis does nothing, as it generates labels automatically. + */ +void QAbstract3DAxis::setLabels(const QStringList &labels) +{ + Q_UNUSED(labels) +} + +QStringList QAbstract3DAxis::labels() const +{ + d_ptr->updateLabels(); + return d_ptr->m_labels; +} + +/*! + * Sets value range of the axis from \a min to \a max. + * When setting the range, the max is adjusted if necessary, to ensure that the range remains valid. + * \note For QCategory3DAxis this specifies the index range of rows or columns to show. + */ +void QAbstract3DAxis::setRange(float min, float max) +{ + d_ptr->setRange(min, max); + setAutoAdjustRange(false); +} + +/*! + * \property QAbstract3DAxis::min + * + * Defines the minimum value on the axis. + * When setting this property the max is adjusted if necessary, to ensure that the range remains + * valid. + * \note For QCategory3DAxis this specifies the index of the first row or column to show. + */ +void QAbstract3DAxis::setMin(float min) +{ + d_ptr->setMin(min); + setAutoAdjustRange(false); +} + +/*! + * \property QAbstract3DAxis::max + * + * Defines the maximum value on the axis. + * When setting this property the min is adjusted if necessary, to ensure that the range remains + * valid. + * \note For QCategory3DAxis this specifies the index of the last row or column to show. + */ +void QAbstract3DAxis::setMax(float max) +{ + d_ptr->setMax(max); + setAutoAdjustRange(false); +} + +float QAbstract3DAxis::min() const +{ + return d_ptr->m_min; +} + +float QAbstract3DAxis::max() const +{ + return d_ptr->m_max; +} + +/*! + * \property QAbstract3DAxis::autoAdjustRange + * + * If set, the axis will automatically adjust the range so that all data fits in it. + * + * \sa setRange(), setMin(), setMax() + */ +void QAbstract3DAxis::setAutoAdjustRange(bool autoAdjust) +{ + if (d_ptr->m_autoAdjust != autoAdjust) { + d_ptr->m_autoAdjust = autoAdjust; + emit autoAdjustRangeChanged(autoAdjust); + } +} + +bool QAbstract3DAxis::isAutoAdjustRange() const +{ + return d_ptr->m_autoAdjust; +} + +/*! + * \fn QAbstract3DAxis::rangeChanged(float min, float max) + * + * Emits range \a min and \a max values when range changes. + */ + +// QAbstract3DAxisPrivate + +QAbstract3DAxisPrivate::QAbstract3DAxisPrivate(QAbstract3DAxis *q, QAbstract3DAxis::AxisType type) + : QObject(0), + q_ptr(q), + m_orientation(QAbstract3DAxis::AxisOrientationNone), + m_type(type), + m_isDefaultAxis(false), + m_min(0.0f), + m_max(10.0f), + m_autoAdjust(true), + m_onlyPositiveValues(false), + m_allowMinMaxSame(false) +{ +} + +QAbstract3DAxisPrivate::~QAbstract3DAxisPrivate() +{ +} + +void QAbstract3DAxisPrivate::setOrientation(QAbstract3DAxis::AxisOrientation orientation) +{ + if (m_orientation == QAbstract3DAxis::AxisOrientationNone) { + m_orientation = orientation; + emit q_ptr->orientationChanged(orientation); + } else { + Q_ASSERT("Attempted to reset axis orientation."); + } +} + +void QAbstract3DAxisPrivate::updateLabels() +{ + // Default implementation does nothing +} + +void QAbstract3DAxisPrivate::setRange(float min, float max) +{ + bool adjusted = false; + if (m_onlyPositiveValues) { + if (min < 0.0f) { + min = 0.0f; + adjusted = true; + } + if (max < 0.0f) { + max = 0.0f; + adjusted = true; + } + } + // If min >= max, we adjust ranges so that + // m_max becomes (min + 1.0f) + // as axes need some kind of valid range. + bool minDirty = false; + bool maxDirty = false; + if (m_min != min) { + m_min = min; + minDirty = true; + } + if (m_max != max || min > max || (!m_allowMinMaxSame && min == max)) { + if (min > max || (!m_allowMinMaxSame && min == max)) { + m_max = min + 1.0f; + adjusted = true; + } else { + m_max = max; + } + maxDirty = true; + } + + if (minDirty || maxDirty) { + if (adjusted) { + qWarning() << "Warning: Tried to set invalid range for axis." + " Range automatically adjusted to a valid one:" + << min << "-" << max << "-->" << m_min << "-" << m_max; + } + emit q_ptr->rangeChanged(m_min, m_max); + } + + if (minDirty) + emit q_ptr->minChanged(m_min); + if (maxDirty) + emit q_ptr->maxChanged(m_max); +} + +void QAbstract3DAxisPrivate::setMin(float min) +{ + if (m_onlyPositiveValues) { + if (min < 0.0f) { + min = 0.0f; + qWarning() << "Warning: Tried to set negative minimum for an axis that only supports" + " positive values:" << min; + } + } + + if (m_min != min) { + bool maxChanged = false; + if (min > m_max || (!m_allowMinMaxSame && min == m_max)) { + float oldMax = m_max; + m_max = min + 1.0f; + qWarning() << "Warning: Tried to set minimum to equal or larger than maximum for" + " value axis. Maximum automatically adjusted to a valid one:" + << oldMax << "-->" << m_max; + maxChanged = true; + } + m_min = min; + + emit q_ptr->rangeChanged(m_min, m_max); + emit q_ptr->minChanged(m_min); + if (maxChanged) + emit q_ptr->maxChanged(m_max); + } +} + +void QAbstract3DAxisPrivate::setMax(float max) +{ + if (m_onlyPositiveValues) { + if (max < 0.0f) { + max = 0.0f; + qWarning() << "Warning: Tried to set negative maximum for an axis that only supports" + " positive values:" << max; + } + } + + if (m_max != max) { + bool minChanged = false; + if (m_min > max || (!m_allowMinMaxSame && m_min == max)) { + float oldMin = m_min; + m_min = max - 1.0f; + if (m_onlyPositiveValues && m_min < 0.0f) { + m_min = 0.0f; + if (!m_allowMinMaxSame && max == 0.0f) { + m_min = oldMin; + qWarning() << "Unable to set maximum value to zero."; + return; + } + } + qWarning() << "Warning: Tried to set maximum to equal or smaller than minimum for" + " value axis. Minimum automatically adjusted to a valid one:" + << oldMin << "-->" << m_min; + minChanged = true; + } + m_max = max; + emit q_ptr->rangeChanged(m_min, m_max); + emit q_ptr->maxChanged(m_max); + if (minChanged) + emit q_ptr->minChanged(m_min); + } +} + +QT_DATAVISUALIZATION_END_NAMESPACE diff --git a/src/datavisualization/axis/qabstract3daxis.h b/src/datavisualization/axis/qabstract3daxis.h new file mode 100644 index 00000000..ef9f9c78 --- /dev/null +++ b/src/datavisualization/axis/qabstract3daxis.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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 QtDataVisualization module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 +** +****************************************************************************/ + +#ifndef QABSTRACT3DAXIS_H +#define QABSTRACT3DAXIS_H + +#include +#include +#include +#include +#include + +QT_DATAVISUALIZATION_BEGIN_NAMESPACE + +class QAbstract3DAxisPrivate; + +class QT_DATAVISUALIZATION_EXPORT QAbstract3DAxis : public QObject +{ + Q_OBJECT + Q_ENUMS(AxisOrientation) + Q_ENUMS(AxisType) + Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged) + Q_PROPERTY(QStringList labels READ labels WRITE setLabels NOTIFY labelsChanged) + Q_PROPERTY(AxisOrientation orientation READ orientation NOTIFY orientationChanged) + Q_PROPERTY(AxisType type READ type CONSTANT) + Q_PROPERTY(float min READ min WRITE setMin NOTIFY minChanged) + Q_PROPERTY(float max READ max WRITE setMax NOTIFY maxChanged) + Q_PROPERTY(bool autoAdjustRange READ isAutoAdjustRange WRITE setAutoAdjustRange NOTIFY autoAdjustRangeChanged) + +public: + enum AxisOrientation { + AxisOrientationNone = 0, + AxisOrientationX = 1, + AxisOrientationY = 2, + AxisOrientationZ = 4 + }; + + enum AxisType { + AxisTypeNone = 0, + AxisTypeCategory = 1, + AxisTypeValue = 2 + //AxisTypeLogValue = 6 // inherits valueaxis (4 + 2) // TODO + }; + +protected: + explicit QAbstract3DAxis(QAbstract3DAxisPrivate *d, QObject *parent = 0); + +public: + virtual ~QAbstract3DAxis(); + + void setTitle(QString title); + QString title() const; + + void setLabels(const QStringList &labels); + QStringList labels() const; + + AxisOrientation orientation() const; + AxisType type() const; + + void setMin(float min); + float min() const; + + void setMax(float max); + float max() const; + + void setAutoAdjustRange(bool autoAdjust); + bool isAutoAdjustRange() const; + + void setRange(float min, float max); + +signals: + void titleChanged(QString newTitle); + void labelsChanged(); + void orientationChanged(AxisOrientation orientation); + void minChanged(float value); + void maxChanged(float value); + void rangeChanged(float min, float max); + void autoAdjustRangeChanged(bool autoAdjust); + +protected: + QScopedPointer d_ptr; + +private: + Q_DISABLE_COPY(QAbstract3DAxis) + + friend class Abstract3DController; + friend class Bars3DController; +}; + +QT_DATAVISUALIZATION_END_NAMESPACE + +#endif diff --git a/src/datavisualization/axis/qabstract3daxis_p.h b/src/datavisualization/axis/qabstract3daxis_p.h new file mode 100644 index 00000000..da6964ad --- /dev/null +++ b/src/datavisualization/axis/qabstract3daxis_p.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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 QtDataVisualization module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the QtDataVisualization 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. + +#include "datavisualizationglobal_p.h" +#include "qabstract3daxis.h" +#include "abstract3dcontroller_p.h" + +#ifndef QABSTRACT3DAXIS_P_H +#define QABSTRACT3DAXIS_P_H + +QT_DATAVISUALIZATION_BEGIN_NAMESPACE + +class QAbstract3DAxisPrivate : public QObject +{ + Q_OBJECT +public: + QAbstract3DAxisPrivate(QAbstract3DAxis *q, QAbstract3DAxis::AxisType type); + virtual ~QAbstract3DAxisPrivate(); + + void setOrientation(QAbstract3DAxis::AxisOrientation orientation); + + inline bool isDefaultAxis() { return m_isDefaultAxis; } + inline void setDefaultAxis(bool isDefault) { m_isDefaultAxis = isDefault; } + + virtual void setRange(float min, float max); + virtual void setMin(float min); + virtual void setMax (float max); + +protected: + virtual void updateLabels(); + + QAbstract3DAxis *q_ptr; + + QString m_title; + QStringList m_labels; + QAbstract3DAxis::AxisOrientation m_orientation; + QAbstract3DAxis::AxisType m_type; + bool m_isDefaultAxis; + float m_min; + float m_max; + bool m_autoAdjust; + bool m_onlyPositiveValues; + bool m_allowMinMaxSame; + + friend class QAbstract3DAxis; + friend class QValue3DAxis; + friend class QCategory3DAxis; +}; + +QT_DATAVISUALIZATION_END_NAMESPACE + +#endif diff --git a/src/datavisualization/axis/qcategory3daxis.cpp b/src/datavisualization/axis/qcategory3daxis.cpp new file mode 100644 index 00000000..b5999aaa --- /dev/null +++ b/src/datavisualization/axis/qcategory3daxis.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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 QtDataVisualization module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 +** +****************************************************************************/ + +#include "qcategory3daxis.h" +#include "qcategory3daxis_p.h" +#include "bars3dcontroller_p.h" +#include "qbardataproxy.h" + +QT_DATAVISUALIZATION_BEGIN_NAMESPACE + +/*! + * \class QCategory3DAxis + * \inmodule QtDataVisualization + * \brief The QCategory3DAxis class is used for manipulating an axis of a graph. + * \since Qt Data Visualization 1.0 + * + * QCategory3DAxis provides an axis that can be given labels. The axis is divided into equal-sized + * categories based on the data window size defined by setting the axis range. + * + * Grid lines are drawn between categories, if visible. Labels are drawn to positions of categories + * if provided. + */ + +/*! + * \qmltype CategoryAxis3D + * \inqmlmodule QtDataVisualization + * \since QtDataVisualization 1.0 + * \ingroup datavisualization_qml + * \instantiates QCategory3DAxis + * \inherits AbstractAxis3D + * \brief The CategoryAxis3D type is used for manipulating an axis of a graph. + * + * This type provides an axis that can be given labels. + */ + +/*! + * \qmlproperty list CategoryAxis3D::labels + * + * Defines labels for axis applied to categories. If there are fewer labels than categories, the + * remaining ones do not have a label. If category labels are not defined explicitly, labels are + * generated from the data row (or column) labels. + * + * \note If the graph has multiple visible series and category labels are not defined explicitly, + * changing the rows (or columns) on any of the attached series will regenerate the labels. + */ + +/*! + * Constructs QCategory3DAxis with \a parent. + */ +QCategory3DAxis::QCategory3DAxis(QObject *parent) : + QAbstract3DAxis(new QCategory3DAxisPrivate(this), parent) +{ + connect(this, &QCategory3DAxis::labelsChanged, this, &QAbstract3DAxis::labelsChanged); +} + +/*! + * Destroys QCategory3DAxis. + */ +QCategory3DAxis::~QCategory3DAxis() +{ +} + +/*! + * \property QCategory3DAxis::labels + * + * Defines labels for axis applied to categories. If there are fewer labels than categories, the + * remaining ones do not have a label. If category labels are not defined explicitly, labels are + * generated from the data row (or column) labels. + * + * \note If the graph has multiple visible series and category labels are not defined explicitly, + * changing the rows (or columns) on any of the attached series will regenerate the labels. + */ +QStringList QCategory3DAxis::labels() const +{ + return QAbstract3DAxis::labels(); +} + +void QCategory3DAxis::setLabels(const QStringList &labels) +{ + dptr()->m_labelsExplicitlySet = !labels.isEmpty(); + bool labelsFromData = false; + + // Get labels from data proxy if axis is attached to a bar controller and an active axis there + if (labels.isEmpty()) { + Bars3DController *controller = qobject_cast(parent()); + if (controller) { + if (controller->axisX() == this) { + controller->handleDataRowLabelsChanged(); + labelsFromData = true; + } else if (controller->axisZ() == this) { + controller->handleDataColumnLabelsChanged(); + labelsFromData = true; + } + } + } + + if (!labelsFromData && d_ptr->m_labels != labels) { + d_ptr->m_labels = labels; + emit labelsChanged(); + } +} + +/*! + * \internal + */ +QCategory3DAxisPrivate *QCategory3DAxis::dptr() +{ + return static_cast(d_ptr.data()); +} + +QCategory3DAxisPrivate::QCategory3DAxisPrivate(QCategory3DAxis *q) + : QAbstract3DAxisPrivate(q, QAbstract3DAxis::AxisTypeCategory), + m_labelsExplicitlySet(false) +{ + m_onlyPositiveValues = true; + m_allowMinMaxSame = true; +} + +QCategory3DAxisPrivate::~QCategory3DAxisPrivate() +{ +} + +/*! + * \internal + * Controller uses this function to set labels from data proxy as category labels. + * If the labels have been set explicitly by the user, data proxy labels are not used. + */ +void QCategory3DAxisPrivate::setDataLabels(const QStringList &labels) +{ + if (!m_labelsExplicitlySet && m_labels != labels) { + m_labels = labels; + emit qptr()->labelsChanged(); + } +} + +QCategory3DAxis *QCategory3DAxisPrivate::qptr() +{ + return static_cast(q_ptr); +} + +QT_DATAVISUALIZATION_END_NAMESPACE diff --git a/src/datavisualization/axis/qcategory3daxis.h b/src/datavisualization/axis/qcategory3daxis.h new file mode 100644 index 00000000..fdedf795 --- /dev/null +++ b/src/datavisualization/axis/qcategory3daxis.h @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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 QtDataVisualization module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 +** +****************************************************************************/ + +#ifndef QCATEGORY3DAXIS_H +#define QCATEGORY3DAXIS_H + +#include + +QT_DATAVISUALIZATION_BEGIN_NAMESPACE + +class QCategory3DAxisPrivate; + +class QT_DATAVISUALIZATION_EXPORT QCategory3DAxis : public QAbstract3DAxis +{ + Q_OBJECT + Q_PROPERTY(QStringList labels READ labels WRITE setLabels NOTIFY labelsChanged) + +public: + explicit QCategory3DAxis(QObject *parent = 0); + virtual ~QCategory3DAxis(); + + void setLabels(const QStringList &labels); + QStringList labels() const; + +signals: + void labelsChanged(); + +protected: + QCategory3DAxisPrivate *dptr(); + +private: + Q_DISABLE_COPY(QCategory3DAxis) + friend class Bars3DController; +}; + +QT_DATAVISUALIZATION_END_NAMESPACE + +#endif diff --git a/src/datavisualization/axis/qcategory3daxis_p.h b/src/datavisualization/axis/qcategory3daxis_p.h new file mode 100644 index 00000000..dfcc9961 --- /dev/null +++ b/src/datavisualization/axis/qcategory3daxis_p.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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 QtDataVisualization module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the QtDataVisualization 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. + +#include "qcategory3daxis.h" +#include "qabstract3daxis_p.h" +#include "qbardataitem.h" + +#ifndef QCATEGORY3DAXIS_P_H +#define QCATEGORY3DAXIS_P_H + +QT_DATAVISUALIZATION_BEGIN_NAMESPACE + +class QCategory3DAxisPrivate : public QAbstract3DAxisPrivate +{ + Q_OBJECT + +public: + QCategory3DAxisPrivate(QCategory3DAxis *q); + virtual ~QCategory3DAxisPrivate(); + + void setDataLabels(const QStringList &labels); + +private: + QCategory3DAxis *qptr(); + + bool m_labelsExplicitlySet; + friend class QCategory3DAxis; +}; + +QT_DATAVISUALIZATION_END_NAMESPACE + +#endif diff --git a/src/datavisualization/axis/qvalue3daxis.cpp b/src/datavisualization/axis/qvalue3daxis.cpp new file mode 100644 index 00000000..a88a9ef5 --- /dev/null +++ b/src/datavisualization/axis/qvalue3daxis.cpp @@ -0,0 +1,270 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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 QtDataVisualization module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 +** +****************************************************************************/ + +#include "qvalue3daxis.h" +#include "qvalue3daxis_p.h" +#include "utils_p.h" + +QT_DATAVISUALIZATION_BEGIN_NAMESPACE + +/*! + * \class QValue3DAxis + * \inmodule QtDataVisualization + * \brief The QValue3DAxis class is used for manipulating an axis of a graph. + * \since Qt Data Visualization 1.0 + * + * QValue3DAxis provides an axis that can be given a range of values and segment and subsegment + * counts to divide the range into. + * + * Labels are drawn between each segment. Grid lines are drawn between each segment and each + * subsegment. \note If visible, there will always be at least two grid lines and labels indicating + * the minimum and the maximum values of the range, as there is always at least one segment. + */ + +/*! + * \qmltype ValueAxis3D + * \inqmlmodule QtDataVisualization + * \since QtDataVisualization 1.0 + * \ingroup datavisualization_qml + * \instantiates QValue3DAxis + * \inherits AbstractAxis3D + * \brief The ValueAxis3D type is used for manipulating an axis of a graph. + * + * This type provides an axis that can be given a range of values and segment and subsegment + * counts to divide the range into. + */ + + +/*! + * \qmlproperty int ValueAxis3D::segmentCount + * + * Defines the number of segments on the axis. This indicates how many labels are drawn. The number + * of grid lines to be drawn is calculated with formula: \c {segments * subsegments + 1}. + * The preset default is \c 5, and it can not be below \c 1. + */ + +/*! + * \qmlproperty int ValueAxis3D::subSegmentCount + * + * Defines the number of subsegments inside each segment on the axis. Grid lines are drawn between + * each subsegment, in addition to each segment. + * The preset default is \c 1, and it can not be below \c 1. + */ + +/*! + * \qmlproperty string ValueAxis3D::labelFormat + * + * Defines the label format to be used for the labels on this axis. Supported specifiers are: + * \c {d, i, o, x, X, f, F, e, E, g, G, c}. See QString::sprintf() for additional details. + */ + +/*! + * Constructs QValue3DAxis with the given \a parent. + */ +QValue3DAxis::QValue3DAxis(QObject *parent) : + QAbstract3DAxis(new QValue3DAxisPrivate(this), parent) +{ +} + +/*! + * Destroys QValue3DAxis. + */ +QValue3DAxis::~QValue3DAxis() +{ +} + + +/*! + * \property QValue3DAxis::segmentCount + * + * Defines the number of segments on the axis. This indicates how many labels are drawn. The number + * of grid lines to be drawn is calculated with formula: \c {segments * subsegments + 1}. + * The preset default is \c 5, and it can not be below \c 1. + * + * \sa setSubSegmentCount() + */ +void QValue3DAxis::setSegmentCount(int count) +{ + if (count <= 0) { + qWarning() << "Warning: Illegal segment count automatically adjusted to a legal one:" + << count << "-> 1"; + count = 1; + } + if (dptr()->m_segmentCount != count){ + dptr()->m_segmentCount = count; + dptr()->emitLabelsChanged(); + emit segmentCountChanged(count); + } +} + +int QValue3DAxis::segmentCount() const +{ + return dptrc()->m_segmentCount; +} + +/*! + * \property QValue3DAxis::subSegmentCount + * + * Defines the number of subsegments inside each segment on the axis. Grid lines are drawn between + * each subsegment, in addition to each segment. + * The preset default is \c 1, and it can not be below \c 1. + * + * \sa setSegmentCount() + */ +void QValue3DAxis::setSubSegmentCount(int count) +{ + if (count <= 0) { + qWarning() << "Warning: Illegal subsegment count automatically adjusted to a legal one:" + << count << "-> 1"; + count = 1; + } + if (dptr()->m_subSegmentCount != count) { + dptr()->m_subSegmentCount = count; + emit subSegmentCountChanged(count); + } +} + +int QValue3DAxis::subSegmentCount() const +{ + return dptrc()->m_subSegmentCount; +} + +/*! + * \property QValue3DAxis::labelFormat + * + * Defines the label format to be used for the labels on this axis. Supported specifiers are: + * \c {d, i, o, x, X, f, F, e, E, g, G, c}. See QString::sprintf() for additional details. + * + * Usage example: + * + * \c {axis->setLabelFormat("%.2f mm");} + */ +void QValue3DAxis::setLabelFormat(const QString &format) +{ + if (dptr()->m_labelFormat != format) { + dptr()->m_labelFormat = format; + dptr()->emitLabelsChanged(); + emit labelFormatChanged(format); + } +} + +QString QValue3DAxis::labelFormat() const +{ + return dptrc()->m_labelFormat; +} + +/*! + * \internal + */ +QValue3DAxisPrivate *QValue3DAxis::dptr() +{ + return static_cast(d_ptr.data()); +} + +/*! + * \internal + */ +const QValue3DAxisPrivate *QValue3DAxis::dptrc() const +{ + return static_cast(d_ptr.data()); +} + +QValue3DAxisPrivate::QValue3DAxisPrivate(QValue3DAxis *q) + : QAbstract3DAxisPrivate(q, QAbstract3DAxis::AxisTypeValue), + m_segmentCount(5), + m_subSegmentCount(1), + m_labelFormat(Utils::defaultLabelFormat()), + m_labelsDirty(true) +{ +} + +QValue3DAxisPrivate::~QValue3DAxisPrivate() +{ +} + +void QValue3DAxisPrivate::setRange(float min, float max) +{ + bool dirty = (min != m_min || max != m_max); + + QAbstract3DAxisPrivate::setRange(min, max); + + if (dirty) + emitLabelsChanged(); +} + +void QValue3DAxisPrivate::setMin(float min) +{ + bool dirty = (min != m_min); + + QAbstract3DAxisPrivate::setMin(min); + + if (dirty) + emitLabelsChanged(); +} + +void QValue3DAxisPrivate::setMax(float max) +{ + bool dirty = (max != m_max); + + QAbstract3DAxisPrivate::setMax(max); + + if (dirty) + emitLabelsChanged(); +} + +void QValue3DAxisPrivate::emitLabelsChanged() +{ + m_labelsDirty = true; + emit q_ptr->labelsChanged(); +} + +void QValue3DAxisPrivate::updateLabels() +{ + if (!m_labelsDirty) + return; + + m_labelsDirty = false; + + QStringList newLabels; + newLabels.reserve(m_segmentCount + 1); + + // First label is at axis min, which is an extra segment + float segmentStep = (m_max - m_min) / m_segmentCount; + + QString formatString(m_labelFormat); + Utils::ParamType paramType = Utils::findFormatParamType(formatString); + QByteArray formatArray = formatString.toUtf8(); + + for (int i = 0; i < m_segmentCount; i++) { + float value = m_min + (segmentStep * i); + newLabels.append(Utils::formatLabel(formatArray, paramType, value)); + } + + // Ensure max label doesn't suffer from any rounding errors + newLabels.append(Utils::formatLabel(formatArray, paramType, m_max)); + + if (m_labels != newLabels) + m_labels = newLabels; +} + +QValue3DAxis *QValue3DAxisPrivate::qptr() +{ + return static_cast(q_ptr); +} + +QT_DATAVISUALIZATION_END_NAMESPACE diff --git a/src/datavisualization/axis/qvalue3daxis.h b/src/datavisualization/axis/qvalue3daxis.h new file mode 100644 index 00000000..3bdeb678 --- /dev/null +++ b/src/datavisualization/axis/qvalue3daxis.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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 QtDataVisualization module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 +** +****************************************************************************/ + +#ifndef QVALUE3DAXIS_H +#define QVALUE3DAXIS_H + +#include + +QT_DATAVISUALIZATION_BEGIN_NAMESPACE + +class QValue3DAxisPrivate; + +class QT_DATAVISUALIZATION_EXPORT QValue3DAxis : public QAbstract3DAxis +{ + Q_OBJECT + Q_PROPERTY(int segmentCount READ segmentCount WRITE setSegmentCount NOTIFY segmentCountChanged) + Q_PROPERTY(int subSegmentCount READ subSegmentCount WRITE setSubSegmentCount NOTIFY subSegmentCountChanged) + Q_PROPERTY(QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged) + +public: + explicit QValue3DAxis(QObject *parent = 0); + virtual ~QValue3DAxis(); + + int segmentCount() const; + int subSegmentCount() const; + QString labelFormat() const; + + void setSegmentCount(int count); + void setSubSegmentCount(int count); + void setLabelFormat(const QString &format); + +signals: + void segmentCountChanged(int count); + void subSegmentCountChanged(int count); + void labelFormatChanged(QString format); + +protected: + QValue3DAxisPrivate *dptr(); + const QValue3DAxisPrivate *dptrc() const; + +private: + Q_DISABLE_COPY(QValue3DAxis) + friend class Bars3DController; + friend class Scatter3DController; + friend class Surface3DController; +}; + +QT_DATAVISUALIZATION_END_NAMESPACE + +#endif diff --git a/src/datavisualization/axis/qvalue3daxis_p.h b/src/datavisualization/axis/qvalue3daxis_p.h new file mode 100644 index 00000000..508453e8 --- /dev/null +++ b/src/datavisualization/axis/qvalue3daxis_p.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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 QtDataVisualization module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the QtDataVisualization 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. + +#include "qvalue3daxis.h" +#include "qabstract3daxis_p.h" + +#ifndef QVALUE3DAXIS_P_H +#define QVALUE3DAXIS_P_H + +QT_DATAVISUALIZATION_BEGIN_NAMESPACE + +class QValue3DAxisPrivate : public QAbstract3DAxisPrivate +{ + Q_OBJECT + +public: + QValue3DAxisPrivate(QValue3DAxis *q); + virtual ~QValue3DAxisPrivate(); + + virtual void setRange(float min, float max); + virtual void setMin(float min); + virtual void setMax (float max); + +protected: + void emitLabelsChanged(); + virtual void updateLabels(); + + int m_segmentCount; + int m_subSegmentCount; + QString m_labelFormat; + bool m_labelsDirty; + +private: + QValue3DAxis *qptr(); + + friend class QValue3DAxis; +}; + +QT_DATAVISUALIZATION_END_NAMESPACE + +#endif -- cgit v1.2.3 From 64d6b482bfb9dbacd548b72cb9c073513f6aa56f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Korpip=C3=A4=C3=A4?= Date: Wed, 15 Jan 2014 11:34:59 +0200 Subject: Removed QDataVis and namespace macros - docs will be fixed in QTRD-2594 Task-number: QTRD-2699 Task-number: QTRD-2700 Change-Id: Ia89d365c2de5d9254b165feb4f0a54ec099084be Reviewed-by: Miikka Heikkinen --- src/datavisualization/axis/qabstract3daxis.cpp | 4 ++-- src/datavisualization/axis/qabstract3daxis.h | 7 ++++--- src/datavisualization/axis/qabstract3daxis_p.h | 4 ++-- src/datavisualization/axis/qcategory3daxis.cpp | 4 ++-- src/datavisualization/axis/qcategory3daxis.h | 4 ++-- src/datavisualization/axis/qcategory3daxis_p.h | 4 ++-- src/datavisualization/axis/qvalue3daxis.cpp | 4 ++-- src/datavisualization/axis/qvalue3daxis.h | 4 ++-- src/datavisualization/axis/qvalue3daxis_p.h | 4 ++-- 9 files changed, 20 insertions(+), 19 deletions(-) (limited to 'src/datavisualization/axis') diff --git a/src/datavisualization/axis/qabstract3daxis.cpp b/src/datavisualization/axis/qabstract3daxis.cpp index 5f1121c4..d2c0f6e8 100644 --- a/src/datavisualization/axis/qabstract3daxis.cpp +++ b/src/datavisualization/axis/qabstract3daxis.cpp @@ -19,7 +19,7 @@ #include "qabstract3daxis.h" #include "qabstract3daxis_p.h" -QT_DATAVISUALIZATION_BEGIN_NAMESPACE +namespace QtDataVisualization { /*! * \class QAbstract3DAxis @@ -401,4 +401,4 @@ void QAbstract3DAxisPrivate::setMax(float max) } } -QT_DATAVISUALIZATION_END_NAMESPACE +} diff --git a/src/datavisualization/axis/qabstract3daxis.h b/src/datavisualization/axis/qabstract3daxis.h index ef9f9c78..c85e50d0 100644 --- a/src/datavisualization/axis/qabstract3daxis.h +++ b/src/datavisualization/axis/qabstract3daxis.h @@ -19,13 +19,14 @@ #ifndef QABSTRACT3DAXIS_H #define QABSTRACT3DAXIS_H -#include +#include + #include #include #include #include -QT_DATAVISUALIZATION_BEGIN_NAMESPACE +namespace QtDataVisualization { class QAbstract3DAxisPrivate; @@ -102,6 +103,6 @@ private: friend class Bars3DController; }; -QT_DATAVISUALIZATION_END_NAMESPACE +} #endif diff --git a/src/datavisualization/axis/qabstract3daxis_p.h b/src/datavisualization/axis/qabstract3daxis_p.h index da6964ad..4403cc16 100644 --- a/src/datavisualization/axis/qabstract3daxis_p.h +++ b/src/datavisualization/axis/qabstract3daxis_p.h @@ -33,7 +33,7 @@ #ifndef QABSTRACT3DAXIS_P_H #define QABSTRACT3DAXIS_P_H -QT_DATAVISUALIZATION_BEGIN_NAMESPACE +namespace QtDataVisualization { class QAbstract3DAxisPrivate : public QObject { @@ -72,6 +72,6 @@ protected: friend class QCategory3DAxis; }; -QT_DATAVISUALIZATION_END_NAMESPACE +} #endif diff --git a/src/datavisualization/axis/qcategory3daxis.cpp b/src/datavisualization/axis/qcategory3daxis.cpp index b5999aaa..0a0cc2e8 100644 --- a/src/datavisualization/axis/qcategory3daxis.cpp +++ b/src/datavisualization/axis/qcategory3daxis.cpp @@ -21,7 +21,7 @@ #include "bars3dcontroller_p.h" #include "qbardataproxy.h" -QT_DATAVISUALIZATION_BEGIN_NAMESPACE +namespace QtDataVisualization { /*! * \class QCategory3DAxis @@ -153,4 +153,4 @@ QCategory3DAxis *QCategory3DAxisPrivate::qptr() return static_cast(q_ptr); } -QT_DATAVISUALIZATION_END_NAMESPACE +} diff --git a/src/datavisualization/axis/qcategory3daxis.h b/src/datavisualization/axis/qcategory3daxis.h index fdedf795..2d3235b4 100644 --- a/src/datavisualization/axis/qcategory3daxis.h +++ b/src/datavisualization/axis/qcategory3daxis.h @@ -21,7 +21,7 @@ #include -QT_DATAVISUALIZATION_BEGIN_NAMESPACE +namespace QtDataVisualization { class QCategory3DAxisPrivate; @@ -48,6 +48,6 @@ private: friend class Bars3DController; }; -QT_DATAVISUALIZATION_END_NAMESPACE +} #endif diff --git a/src/datavisualization/axis/qcategory3daxis_p.h b/src/datavisualization/axis/qcategory3daxis_p.h index dfcc9961..6449e999 100644 --- a/src/datavisualization/axis/qcategory3daxis_p.h +++ b/src/datavisualization/axis/qcategory3daxis_p.h @@ -33,7 +33,7 @@ #ifndef QCATEGORY3DAXIS_P_H #define QCATEGORY3DAXIS_P_H -QT_DATAVISUALIZATION_BEGIN_NAMESPACE +namespace QtDataVisualization { class QCategory3DAxisPrivate : public QAbstract3DAxisPrivate { @@ -52,6 +52,6 @@ private: friend class QCategory3DAxis; }; -QT_DATAVISUALIZATION_END_NAMESPACE +} #endif diff --git a/src/datavisualization/axis/qvalue3daxis.cpp b/src/datavisualization/axis/qvalue3daxis.cpp index a88a9ef5..b34d7511 100644 --- a/src/datavisualization/axis/qvalue3daxis.cpp +++ b/src/datavisualization/axis/qvalue3daxis.cpp @@ -20,7 +20,7 @@ #include "qvalue3daxis_p.h" #include "utils_p.h" -QT_DATAVISUALIZATION_BEGIN_NAMESPACE +namespace QtDataVisualization { /*! * \class QValue3DAxis @@ -267,4 +267,4 @@ QValue3DAxis *QValue3DAxisPrivate::qptr() return static_cast(q_ptr); } -QT_DATAVISUALIZATION_END_NAMESPACE +} diff --git a/src/datavisualization/axis/qvalue3daxis.h b/src/datavisualization/axis/qvalue3daxis.h index 3bdeb678..c842167c 100644 --- a/src/datavisualization/axis/qvalue3daxis.h +++ b/src/datavisualization/axis/qvalue3daxis.h @@ -21,7 +21,7 @@ #include -QT_DATAVISUALIZATION_BEGIN_NAMESPACE +namespace QtDataVisualization { class QValue3DAxisPrivate; @@ -60,6 +60,6 @@ private: friend class Surface3DController; }; -QT_DATAVISUALIZATION_END_NAMESPACE +} #endif diff --git a/src/datavisualization/axis/qvalue3daxis_p.h b/src/datavisualization/axis/qvalue3daxis_p.h index 508453e8..08dab486 100644 --- a/src/datavisualization/axis/qvalue3daxis_p.h +++ b/src/datavisualization/axis/qvalue3daxis_p.h @@ -32,7 +32,7 @@ #ifndef QVALUE3DAXIS_P_H #define QVALUE3DAXIS_P_H -QT_DATAVISUALIZATION_BEGIN_NAMESPACE +namespace QtDataVisualization { class QValue3DAxisPrivate : public QAbstract3DAxisPrivate { @@ -61,6 +61,6 @@ private: friend class QValue3DAxis; }; -QT_DATAVISUALIZATION_END_NAMESPACE +} #endif -- cgit v1.2.3 From de93a42512e58c598427178373f0e3e59b04dec7 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 15 Jan 2014 09:43:29 +0200 Subject: Better control of series ordering and 'primary' series for bars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTRD-2578 Change-Id: Icbd945596334afb03d81f3b1d6a72399077455db Reviewed-by: Tomi Korpipää --- src/datavisualization/axis/qcategory3daxis.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/datavisualization/axis') diff --git a/src/datavisualization/axis/qcategory3daxis.cpp b/src/datavisualization/axis/qcategory3daxis.cpp index 0a0cc2e8..0dfe2e4a 100644 --- a/src/datavisualization/axis/qcategory3daxis.cpp +++ b/src/datavisualization/axis/qcategory3daxis.cpp @@ -53,10 +53,7 @@ namespace QtDataVisualization { * * Defines labels for axis applied to categories. If there are fewer labels than categories, the * remaining ones do not have a label. If category labels are not defined explicitly, labels are - * generated from the data row (or column) labels. - * - * \note If the graph has multiple visible series and category labels are not defined explicitly, - * changing the rows (or columns) on any of the attached series will regenerate the labels. + * generated from the data row (or column) labels of the primary series of the graph. */ /*! @@ -80,10 +77,7 @@ QCategory3DAxis::~QCategory3DAxis() * * Defines labels for axis applied to categories. If there are fewer labels than categories, the * remaining ones do not have a label. If category labels are not defined explicitly, labels are - * generated from the data row (or column) labels. - * - * \note If the graph has multiple visible series and category labels are not defined explicitly, - * changing the rows (or columns) on any of the attached series will regenerate the labels. + * generated from the data row (or column) labels of the primary series of the graph. */ QStringList QCategory3DAxis::labels() const { -- cgit v1.2.3 From 3e7dc5bd1769e4578733f7ce0f4eba72346b6d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Korpip=C3=A4=C3=A4?= Date: Thu, 16 Jan 2014 09:29:38 +0200 Subject: Docs updated after namespace macro removal - some links do not work Task-number: QTRD-2594 Change-Id: I255a4c12fe09e1a708c068a68073c1c99d6382b6 Reviewed-by: Miikka Heikkinen --- src/datavisualization/axis/qabstract3daxis.cpp | 8 ++++++-- src/datavisualization/axis/qcategory3daxis.cpp | 9 +++++++-- src/datavisualization/axis/qvalue3daxis.cpp | 9 +++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) (limited to 'src/datavisualization/axis') diff --git a/src/datavisualization/axis/qabstract3daxis.cpp b/src/datavisualization/axis/qabstract3daxis.cpp index d2c0f6e8..99a4a91d 100644 --- a/src/datavisualization/axis/qabstract3daxis.cpp +++ b/src/datavisualization/axis/qabstract3daxis.cpp @@ -22,7 +22,7 @@ namespace QtDataVisualization { /*! - * \class QAbstract3DAxis + * \class QtDataVisualization::QAbstract3DAxis * \inmodule QtDataVisualization * \brief QAbstract3DAxis is base class for axes of a graph. * \since Qt Data Visualization 1.0 @@ -37,7 +37,7 @@ namespace QtDataVisualization { * \inqmlmodule QtDataVisualization * \since QtDataVisualization 1.0 * \ingroup datavisualization_qml - * \instantiates QAbstract3DAxis + * \instantiates QtDataVisualization::QAbstract3DAxis * \brief AbstractAxis3D is base type for axes of a graph. * * This type is uncreatable, but contains properties that are exposed via subtypes. @@ -255,6 +255,10 @@ bool QAbstract3DAxis::isAutoAdjustRange() const */ // QAbstract3DAxisPrivate +/*! + * \class QtDataVisualization::QAbstract3DAxisPrivate + * \internal + */ QAbstract3DAxisPrivate::QAbstract3DAxisPrivate(QAbstract3DAxis *q, QAbstract3DAxis::AxisType type) : QObject(0), diff --git a/src/datavisualization/axis/qcategory3daxis.cpp b/src/datavisualization/axis/qcategory3daxis.cpp index 0dfe2e4a..a29fb376 100644 --- a/src/datavisualization/axis/qcategory3daxis.cpp +++ b/src/datavisualization/axis/qcategory3daxis.cpp @@ -24,7 +24,7 @@ namespace QtDataVisualization { /*! - * \class QCategory3DAxis + * \class QtDataVisualization::QCategory3DAxis * \inmodule QtDataVisualization * \brief The QCategory3DAxis class is used for manipulating an axis of a graph. * \since Qt Data Visualization 1.0 @@ -41,7 +41,7 @@ namespace QtDataVisualization { * \inqmlmodule QtDataVisualization * \since QtDataVisualization 1.0 * \ingroup datavisualization_qml - * \instantiates QCategory3DAxis + * \instantiates QtDataVisualization::QCategory3DAxis * \inherits AbstractAxis3D * \brief The CategoryAxis3D type is used for manipulating an axis of a graph. * @@ -117,6 +117,11 @@ QCategory3DAxisPrivate *QCategory3DAxis::dptr() return static_cast(d_ptr.data()); } +/*! + * \class QtDataVisualization::QCategory3DAxisPrivate + * \internal + */ + QCategory3DAxisPrivate::QCategory3DAxisPrivate(QCategory3DAxis *q) : QAbstract3DAxisPrivate(q, QAbstract3DAxis::AxisTypeCategory), m_labelsExplicitlySet(false) diff --git a/src/datavisualization/axis/qvalue3daxis.cpp b/src/datavisualization/axis/qvalue3daxis.cpp index b34d7511..deee9bac 100644 --- a/src/datavisualization/axis/qvalue3daxis.cpp +++ b/src/datavisualization/axis/qvalue3daxis.cpp @@ -23,7 +23,7 @@ namespace QtDataVisualization { /*! - * \class QValue3DAxis + * \class QtDataVisualization::QValue3DAxis * \inmodule QtDataVisualization * \brief The QValue3DAxis class is used for manipulating an axis of a graph. * \since Qt Data Visualization 1.0 @@ -41,7 +41,7 @@ namespace QtDataVisualization { * \inqmlmodule QtDataVisualization * \since QtDataVisualization 1.0 * \ingroup datavisualization_qml - * \instantiates QValue3DAxis + * \instantiates QtDataVisualization::QValue3DAxis * \inherits AbstractAxis3D * \brief The ValueAxis3D type is used for manipulating an axis of a graph. * @@ -184,6 +184,11 @@ const QValue3DAxisPrivate *QValue3DAxis::dptrc() const return static_cast(d_ptr.data()); } +/*! + * \class QtDataVisualization::QValue3DAxisPrivate + * \internal + */ + QValue3DAxisPrivate::QValue3DAxisPrivate(QValue3DAxis *q) : QAbstract3DAxisPrivate(q, QAbstract3DAxis::AxisTypeValue), m_segmentCount(5), -- cgit v1.2.3 From 8674307d6bafabfcaedfe175b883313f0e7d88b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Korpip=C3=A4=C3=A4?= Date: Thu, 16 Jan 2014 13:33:57 +0200 Subject: Reintroduced namespace macros Task-number: QTRD-2594 Change-Id: I31e1ea20fd590d7bdf3d1218d696915c22c3426b Change-Id: I31e1ea20fd590d7bdf3d1218d696915c22c3426b Reviewed-by: Miikka Heikkinen --- src/datavisualization/axis/qabstract3daxis.cpp | 13 ++++--------- src/datavisualization/axis/qabstract3daxis.h | 4 ++-- src/datavisualization/axis/qabstract3daxis_p.h | 4 ++-- src/datavisualization/axis/qcategory3daxis.cpp | 13 ++++--------- src/datavisualization/axis/qcategory3daxis.h | 4 ++-- src/datavisualization/axis/qcategory3daxis_p.h | 4 ++-- src/datavisualization/axis/qvalue3daxis.cpp | 13 ++++--------- src/datavisualization/axis/qvalue3daxis.h | 4 ++-- src/datavisualization/axis/qvalue3daxis_p.h | 4 ++-- 9 files changed, 24 insertions(+), 39 deletions(-) (limited to 'src/datavisualization/axis') diff --git a/src/datavisualization/axis/qabstract3daxis.cpp b/src/datavisualization/axis/qabstract3daxis.cpp index 99a4a91d..20e7f361 100644 --- a/src/datavisualization/axis/qabstract3daxis.cpp +++ b/src/datavisualization/axis/qabstract3daxis.cpp @@ -19,10 +19,10 @@ #include "qabstract3daxis.h" #include "qabstract3daxis_p.h" -namespace QtDataVisualization { +QT_BEGIN_NAMESPACE_DATAVISUALIZATION /*! - * \class QtDataVisualization::QAbstract3DAxis + * \class QAbstract3DAxis * \inmodule QtDataVisualization * \brief QAbstract3DAxis is base class for axes of a graph. * \since Qt Data Visualization 1.0 @@ -37,7 +37,7 @@ namespace QtDataVisualization { * \inqmlmodule QtDataVisualization * \since QtDataVisualization 1.0 * \ingroup datavisualization_qml - * \instantiates QtDataVisualization::QAbstract3DAxis + * \instantiates QAbstract3DAxis * \brief AbstractAxis3D is base type for axes of a graph. * * This type is uncreatable, but contains properties that are exposed via subtypes. @@ -255,11 +255,6 @@ bool QAbstract3DAxis::isAutoAdjustRange() const */ // QAbstract3DAxisPrivate -/*! - * \class QtDataVisualization::QAbstract3DAxisPrivate - * \internal - */ - QAbstract3DAxisPrivate::QAbstract3DAxisPrivate(QAbstract3DAxis *q, QAbstract3DAxis::AxisType type) : QObject(0), q_ptr(q), @@ -405,4 +400,4 @@ void QAbstract3DAxisPrivate::setMax(float max) } } -} +QT_END_NAMESPACE_DATAVISUALIZATION diff --git a/src/datavisualization/axis/qabstract3daxis.h b/src/datavisualization/axis/qabstract3daxis.h index c85e50d0..c4cb37b2 100644 --- a/src/datavisualization/axis/qabstract3daxis.h +++ b/src/datavisualization/axis/qabstract3daxis.h @@ -26,7 +26,7 @@ #include #include -namespace QtDataVisualization { +QT_BEGIN_NAMESPACE_DATAVISUALIZATION class QAbstract3DAxisPrivate; @@ -103,6 +103,6 @@ private: friend class Bars3DController; }; -} +QT_END_NAMESPACE_DATAVISUALIZATION #endif diff --git a/src/datavisualization/axis/qabstract3daxis_p.h b/src/datavisualization/axis/qabstract3daxis_p.h index 4403cc16..cca31fa4 100644 --- a/src/datavisualization/axis/qabstract3daxis_p.h +++ b/src/datavisualization/axis/qabstract3daxis_p.h @@ -33,7 +33,7 @@ #ifndef QABSTRACT3DAXIS_P_H #define QABSTRACT3DAXIS_P_H -namespace QtDataVisualization { +QT_BEGIN_NAMESPACE_DATAVISUALIZATION class QAbstract3DAxisPrivate : public QObject { @@ -72,6 +72,6 @@ protected: friend class QCategory3DAxis; }; -} +QT_END_NAMESPACE_DATAVISUALIZATION #endif diff --git a/src/datavisualization/axis/qcategory3daxis.cpp b/src/datavisualization/axis/qcategory3daxis.cpp index a29fb376..0ef59b59 100644 --- a/src/datavisualization/axis/qcategory3daxis.cpp +++ b/src/datavisualization/axis/qcategory3daxis.cpp @@ -21,10 +21,10 @@ #include "bars3dcontroller_p.h" #include "qbardataproxy.h" -namespace QtDataVisualization { +QT_BEGIN_NAMESPACE_DATAVISUALIZATION /*! - * \class QtDataVisualization::QCategory3DAxis + * \class QCategory3DAxis * \inmodule QtDataVisualization * \brief The QCategory3DAxis class is used for manipulating an axis of a graph. * \since Qt Data Visualization 1.0 @@ -41,7 +41,7 @@ namespace QtDataVisualization { * \inqmlmodule QtDataVisualization * \since QtDataVisualization 1.0 * \ingroup datavisualization_qml - * \instantiates QtDataVisualization::QCategory3DAxis + * \instantiates QCategory3DAxis * \inherits AbstractAxis3D * \brief The CategoryAxis3D type is used for manipulating an axis of a graph. * @@ -117,11 +117,6 @@ QCategory3DAxisPrivate *QCategory3DAxis::dptr() return static_cast(d_ptr.data()); } -/*! - * \class QtDataVisualization::QCategory3DAxisPrivate - * \internal - */ - QCategory3DAxisPrivate::QCategory3DAxisPrivate(QCategory3DAxis *q) : QAbstract3DAxisPrivate(q, QAbstract3DAxis::AxisTypeCategory), m_labelsExplicitlySet(false) @@ -152,4 +147,4 @@ QCategory3DAxis *QCategory3DAxisPrivate::qptr() return static_cast(q_ptr); } -} +QT_END_NAMESPACE_DATAVISUALIZATION diff --git a/src/datavisualization/axis/qcategory3daxis.h b/src/datavisualization/axis/qcategory3daxis.h index 2d3235b4..d16eac2a 100644 --- a/src/datavisualization/axis/qcategory3daxis.h +++ b/src/datavisualization/axis/qcategory3daxis.h @@ -21,7 +21,7 @@ #include -namespace QtDataVisualization { +QT_BEGIN_NAMESPACE_DATAVISUALIZATION class QCategory3DAxisPrivate; @@ -48,6 +48,6 @@ private: friend class Bars3DController; }; -} +QT_END_NAMESPACE_DATAVISUALIZATION #endif diff --git a/src/datavisualization/axis/qcategory3daxis_p.h b/src/datavisualization/axis/qcategory3daxis_p.h index 6449e999..f7a16161 100644 --- a/src/datavisualization/axis/qcategory3daxis_p.h +++ b/src/datavisualization/axis/qcategory3daxis_p.h @@ -33,7 +33,7 @@ #ifndef QCATEGORY3DAXIS_P_H #define QCATEGORY3DAXIS_P_H -namespace QtDataVisualization { +QT_BEGIN_NAMESPACE_DATAVISUALIZATION class QCategory3DAxisPrivate : public QAbstract3DAxisPrivate { @@ -52,6 +52,6 @@ private: friend class QCategory3DAxis; }; -} +QT_END_NAMESPACE_DATAVISUALIZATION #endif diff --git a/src/datavisualization/axis/qvalue3daxis.cpp b/src/datavisualization/axis/qvalue3daxis.cpp index deee9bac..609e3b86 100644 --- a/src/datavisualization/axis/qvalue3daxis.cpp +++ b/src/datavisualization/axis/qvalue3daxis.cpp @@ -20,10 +20,10 @@ #include "qvalue3daxis_p.h" #include "utils_p.h" -namespace QtDataVisualization { +QT_BEGIN_NAMESPACE_DATAVISUALIZATION /*! - * \class QtDataVisualization::QValue3DAxis + * \class QValue3DAxis * \inmodule QtDataVisualization * \brief The QValue3DAxis class is used for manipulating an axis of a graph. * \since Qt Data Visualization 1.0 @@ -41,7 +41,7 @@ namespace QtDataVisualization { * \inqmlmodule QtDataVisualization * \since QtDataVisualization 1.0 * \ingroup datavisualization_qml - * \instantiates QtDataVisualization::QValue3DAxis + * \instantiates QValue3DAxis * \inherits AbstractAxis3D * \brief The ValueAxis3D type is used for manipulating an axis of a graph. * @@ -184,11 +184,6 @@ const QValue3DAxisPrivate *QValue3DAxis::dptrc() const return static_cast(d_ptr.data()); } -/*! - * \class QtDataVisualization::QValue3DAxisPrivate - * \internal - */ - QValue3DAxisPrivate::QValue3DAxisPrivate(QValue3DAxis *q) : QAbstract3DAxisPrivate(q, QAbstract3DAxis::AxisTypeValue), m_segmentCount(5), @@ -272,4 +267,4 @@ QValue3DAxis *QValue3DAxisPrivate::qptr() return static_cast(q_ptr); } -} +QT_END_NAMESPACE_DATAVISUALIZATION diff --git a/src/datavisualization/axis/qvalue3daxis.h b/src/datavisualization/axis/qvalue3daxis.h index c842167c..d5d23825 100644 --- a/src/datavisualization/axis/qvalue3daxis.h +++ b/src/datavisualization/axis/qvalue3daxis.h @@ -21,7 +21,7 @@ #include -namespace QtDataVisualization { +QT_BEGIN_NAMESPACE_DATAVISUALIZATION class QValue3DAxisPrivate; @@ -60,6 +60,6 @@ private: friend class Surface3DController; }; -} +QT_END_NAMESPACE_DATAVISUALIZATION #endif diff --git a/src/datavisualization/axis/qvalue3daxis_p.h b/src/datavisualization/axis/qvalue3daxis_p.h index 08dab486..b1b65fd7 100644 --- a/src/datavisualization/axis/qvalue3daxis_p.h +++ b/src/datavisualization/axis/qvalue3daxis_p.h @@ -32,7 +32,7 @@ #ifndef QVALUE3DAXIS_P_H #define QVALUE3DAXIS_P_H -namespace QtDataVisualization { +QT_BEGIN_NAMESPACE_DATAVISUALIZATION class QValue3DAxisPrivate : public QAbstract3DAxisPrivate { @@ -61,6 +61,6 @@ private: friend class QValue3DAxis; }; -} +QT_END_NAMESPACE_DATAVISUALIZATION #endif -- cgit v1.2.3 From b83dfb2537720492ebd62dfc9733035d5560dddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Korpip=C3=A4=C3=A4?= Date: Fri, 17 Jan 2014 09:23:35 +0200 Subject: Qml enums added Task-number: QTRD-2636 Change-Id: I90a123432172d32fab7efa2ef18ee79d06139b5b Change-Id: I90a123432172d32fab7efa2ef18ee79d06139b5b Reviewed-by: Miikka Heikkinen --- src/datavisualization/axis/qabstract3daxis.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/datavisualization/axis') diff --git a/src/datavisualization/axis/qabstract3daxis.cpp b/src/datavisualization/axis/qabstract3daxis.cpp index 20e7f361..f9128247 100644 --- a/src/datavisualization/axis/qabstract3daxis.cpp +++ b/src/datavisualization/axis/qabstract3daxis.cpp @@ -41,6 +41,8 @@ QT_BEGIN_NAMESPACE_DATAVISUALIZATION * \brief AbstractAxis3D is base type for axes of a graph. * * This type is uncreatable, but contains properties that are exposed via subtypes. + * + * For AbstractAxis3D enums, see \l QAbstract3DAxis::AxisOrientation and \l QAbstract3DAxis::AxisType */ /*! -- cgit v1.2.3 From 072b7614c6b1a1f32a4baebb8260866d72ee9299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Korpip=C3=A4=C3=A4?= Date: Wed, 22 Jan 2014 07:38:02 +0200 Subject: Made jira tasks of TODOs, part 1 - commented-out code will be removed (and made tasks of, if necessary) in part 2 Task-number: QTRD-2398 Change-Id: Ib94a4a873ecd25f4040c74c42902e204f3f41943 Reviewed-by: Miikka Heikkinen --- src/datavisualization/axis/qabstract3daxis.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/datavisualization/axis') diff --git a/src/datavisualization/axis/qabstract3daxis.h b/src/datavisualization/axis/qabstract3daxis.h index c4cb37b2..7cfde83a 100644 --- a/src/datavisualization/axis/qabstract3daxis.h +++ b/src/datavisualization/axis/qabstract3daxis.h @@ -55,7 +55,6 @@ public: AxisTypeNone = 0, AxisTypeCategory = 1, AxisTypeValue = 2 - //AxisTypeLogValue = 6 // inherits valueaxis (4 + 2) // TODO }; protected: -- cgit v1.2.3 From 5e172211056437521ebbe6135661edaa486bee83 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 24 Jan 2014 14:16:12 +0200 Subject: Add missing consts to public apis MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTRD-2807 Change-Id: I74a6735ab37a8b3d97548adba99ca79ce2c7975c Reviewed-by: Tomi Korpipää --- src/datavisualization/axis/qvalue3daxis.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/datavisualization/axis') diff --git a/src/datavisualization/axis/qvalue3daxis.h b/src/datavisualization/axis/qvalue3daxis.h index d5d23825..1bb9cea3 100644 --- a/src/datavisualization/axis/qvalue3daxis.h +++ b/src/datavisualization/axis/qvalue3daxis.h @@ -36,13 +36,14 @@ public: explicit QValue3DAxis(QObject *parent = 0); virtual ~QValue3DAxis(); + void setSegmentCount(int count); int segmentCount() const; - int subSegmentCount() const; - QString labelFormat() const; - void setSegmentCount(int count); void setSubSegmentCount(int count); + int subSegmentCount() const; + void setLabelFormat(const QString &format); + QString labelFormat() const; signals: void segmentCountChanged(int count); -- cgit v1.2.3 From 3b57eb8aaef9886a9975b7b861f31bdf8ed15fdb Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 27 Jan 2014 08:18:03 +0200 Subject: Fix copyright year Task-number: QTRD-2803 Change-Id: If670633f52519741a096abe901d55fd084ddc9c5 Reviewed-by: Miikka Heikkinen --- src/datavisualization/axis/qabstract3daxis.cpp | 2 +- src/datavisualization/axis/qabstract3daxis.h | 2 +- src/datavisualization/axis/qabstract3daxis_p.h | 2 +- src/datavisualization/axis/qcategory3daxis.cpp | 2 +- src/datavisualization/axis/qcategory3daxis.h | 2 +- src/datavisualization/axis/qcategory3daxis_p.h | 2 +- src/datavisualization/axis/qvalue3daxis.cpp | 2 +- src/datavisualization/axis/qvalue3daxis.h | 2 +- src/datavisualization/axis/qvalue3daxis_p.h | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/datavisualization/axis') diff --git a/src/datavisualization/axis/qabstract3daxis.cpp b/src/datavisualization/axis/qabstract3daxis.cpp index f9128247..2ee7a25d 100644 --- a/src/datavisualization/axis/qabstract3daxis.cpp +++ b/src/datavisualization/axis/qabstract3daxis.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc +** Copyright (C) 2014 Digia Plc ** All rights reserved. ** For any questions to Digia, please use contact form at http://qt.digia.com ** diff --git a/src/datavisualization/axis/qabstract3daxis.h b/src/datavisualization/axis/qabstract3daxis.h index 7cfde83a..28b93f36 100644 --- a/src/datavisualization/axis/qabstract3daxis.h +++ b/src/datavisualization/axis/qabstract3daxis.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc +** Copyright (C) 2014 Digia Plc ** All rights reserved. ** For any questions to Digia, please use contact form at http://qt.digia.com ** diff --git a/src/datavisualization/axis/qabstract3daxis_p.h b/src/datavisualization/axis/qabstract3daxis_p.h index cca31fa4..4eb8de68 100644 --- a/src/datavisualization/axis/qabstract3daxis_p.h +++ b/src/datavisualization/axis/qabstract3daxis_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc +** Copyright (C) 2014 Digia Plc ** All rights reserved. ** For any questions to Digia, please use contact form at http://qt.digia.com ** diff --git a/src/datavisualization/axis/qcategory3daxis.cpp b/src/datavisualization/axis/qcategory3daxis.cpp index 0ef59b59..c1d5777a 100644 --- a/src/datavisualization/axis/qcategory3daxis.cpp +++ b/src/datavisualization/axis/qcategory3daxis.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc +** Copyright (C) 2014 Digia Plc ** All rights reserved. ** For any questions to Digia, please use contact form at http://qt.digia.com ** diff --git a/src/datavisualization/axis/qcategory3daxis.h b/src/datavisualization/axis/qcategory3daxis.h index d16eac2a..b16d0444 100644 --- a/src/datavisualization/axis/qcategory3daxis.h +++ b/src/datavisualization/axis/qcategory3daxis.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc +** Copyright (C) 2014 Digia Plc ** All rights reserved. ** For any questions to Digia, please use contact form at http://qt.digia.com ** diff --git a/src/datavisualization/axis/qcategory3daxis_p.h b/src/datavisualization/axis/qcategory3daxis_p.h index f7a16161..1ba5ccb0 100644 --- a/src/datavisualization/axis/qcategory3daxis_p.h +++ b/src/datavisualization/axis/qcategory3daxis_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc +** Copyright (C) 2014 Digia Plc ** All rights reserved. ** For any questions to Digia, please use contact form at http://qt.digia.com ** diff --git a/src/datavisualization/axis/qvalue3daxis.cpp b/src/datavisualization/axis/qvalue3daxis.cpp index 609e3b86..52f1e599 100644 --- a/src/datavisualization/axis/qvalue3daxis.cpp +++ b/src/datavisualization/axis/qvalue3daxis.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc +** Copyright (C) 2014 Digia Plc ** All rights reserved. ** For any questions to Digia, please use contact form at http://qt.digia.com ** diff --git a/src/datavisualization/axis/qvalue3daxis.h b/src/datavisualization/axis/qvalue3daxis.h index 1bb9cea3..c930c700 100644 --- a/src/datavisualization/axis/qvalue3daxis.h +++ b/src/datavisualization/axis/qvalue3daxis.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc +** Copyright (C) 2014 Digia Plc ** All rights reserved. ** For any questions to Digia, please use contact form at http://qt.digia.com ** diff --git a/src/datavisualization/axis/qvalue3daxis_p.h b/src/datavisualization/axis/qvalue3daxis_p.h index b1b65fd7..21fd78ab 100644 --- a/src/datavisualization/axis/qvalue3daxis_p.h +++ b/src/datavisualization/axis/qvalue3daxis_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc +** Copyright (C) 2014 Digia Plc ** All rights reserved. ** For any questions to Digia, please use contact form at http://qt.digia.com ** -- cgit v1.2.3