summaryrefslogtreecommitdiffstats
path: root/src/datavisualization/axis/qabstract3daxis.cpp
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2014-05-16 15:26:14 +0300
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2014-05-19 10:16:10 +0300
commit92ee7767f81f7a15b8773ed97356f01ecac68d0c (patch)
tree7cb14d03a82ce3e33265d82cb8ad2c335a7b842e /src/datavisualization/axis/qabstract3daxis.cpp
parenta998e49b3455c9e28d2ed85f024f28c69921cfd2 (diff)
Implement axis label autorotation
Task-number: QTRD-2857 Change-Id: I158abb75272813cf7eb5d4b419e24325389d940e Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'src/datavisualization/axis/qabstract3daxis.cpp')
-rw-r--r--src/datavisualization/axis/qabstract3daxis.cpp38
1 files changed, 37 insertions, 1 deletions
diff --git a/src/datavisualization/axis/qabstract3daxis.cpp b/src/datavisualization/axis/qabstract3daxis.cpp
index ef4959d4..27951f4c 100644
--- a/src/datavisualization/axis/qabstract3daxis.cpp
+++ b/src/datavisualization/axis/qabstract3daxis.cpp
@@ -89,6 +89,15 @@ QT_BEGIN_NAMESPACE_DATAVISUALIZATION
* If set, the axis will automatically adjust the range so that all data fits in it.
*/
+/*!
+ * \qmlproperty real AbstractAxis3D::labelAutoRotation
+ *
+ * Defines the maximum \a angle the labels can autorotate when the camera angle changes.
+ * The \a angle can be between 0 and 90, inclusive. The default value is 0.
+ * If the value is 0, axis labels do not automatically rotate.
+ * If the value is greater than zero, labels attempt to orient themselves toward the camera, up to
+ * the specified angle.
+ */
/*!
* \enum QAbstract3DAxis::AxisOrientation
@@ -194,6 +203,32 @@ void QAbstract3DAxis::setRange(float min, float max)
}
/*!
+ * \property QAbstract3DAxis::labelAutoRotation
+ *
+ * Defines the maximum \a angle the labels can autorotate when the camera angle changes.
+ * The \a angle can be between 0 and 90, inclusive. The default value is 0.
+ * If the value is 0, axis labels do not automatically rotate.
+ * If the value is greater than zero, labels attempt to orient themselves toward the camera, up to
+ * the specified angle.
+ */
+void QAbstract3DAxis::setLabelAutoRotation(float angle)
+{
+ if (angle < 0.0f)
+ angle = 0.0f;
+ if (angle > 90.0f)
+ angle = 90.0f;
+ if (d_ptr->m_labelAutoRotation != angle) {
+ d_ptr->m_labelAutoRotation = angle;
+ emit labelAutoRotationChanged(angle);
+ }
+}
+
+float QAbstract3DAxis::labelAutoRotation() const
+{
+ return d_ptr->m_labelAutoRotation;
+}
+
+/*!
* \property QAbstract3DAxis::min
*
* Defines the minimum value on the axis.
@@ -266,7 +301,8 @@ QAbstract3DAxisPrivate::QAbstract3DAxisPrivate(QAbstract3DAxis *q, QAbstract3DAx
m_isDefaultAxis(false),
m_min(0.0f),
m_max(10.0f),
- m_autoAdjust(true)
+ m_autoAdjust(true),
+ m_labelAutoRotation(0.0f)
{
}