summaryrefslogtreecommitdiffstats
path: root/src/datavisualization/axis/qvalue3daxis.cpp
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2014-09-18 13:49:23 +0300
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2014-09-19 09:14:13 +0300
commit98e0c04fe78da9735c2943524bd36648b2654f98 (patch)
tree3c711ff622e0fb43b358982fb815065e12d49af0 /src/datavisualization/axis/qvalue3daxis.cpp
parent0c11550bed204807b8b366fd07862a5da9cd2251 (diff)
Added possibility to change graph's locale
Locale affects how axis labels are formatted. Default locale is still the "C". Task-number: QTRD-3229 Change-Id: I6126ce676906f4bbc91ae0abd18775bc1d564118 Reviewed-by: Mika Salmela <mika.salmela@digia.com> Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'src/datavisualization/axis/qvalue3daxis.cpp')
-rw-r--r--src/datavisualization/axis/qvalue3daxis.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/datavisualization/axis/qvalue3daxis.cpp b/src/datavisualization/axis/qvalue3daxis.cpp
index 8207174f..3b9c9e3d 100644
--- a/src/datavisualization/axis/qvalue3daxis.cpp
+++ b/src/datavisualization/axis/qvalue3daxis.cpp
@@ -18,6 +18,7 @@
#include "qvalue3daxis_p.h"
#include "qvalue3daxisformatter_p.h"
+#include "abstract3dcontroller_p.h"
QT_BEGIN_NAMESPACE_DATAVISUALIZATION
@@ -68,8 +69,16 @@ QT_BEGIN_NAMESPACE_DATAVISUALIZATION
/*!
* \qmlproperty string ValueAxis3D::labelFormat
*
- * Defines the label format to be used for the labels on this axis. Supported specifiers are:
+ * Defines the label format to be used for the labels on this axis. How the format is interpreted
+ * depends on the axis formatter and the locale in use. Using the default formatter and default
+ * locale (\c{"C"}), the formatting uses QString::sprintf(). Supported specifiers are:
* \c {d, i, o, x, X, f, F, e, E, g, G, c}. See QString::sprintf() for additional details.
+ * For other locales, the default formatter uses reduced set of printf format specifiers:
+ * \c {d, i, f, F, e, E, g, G}. In these cases, the only supported modifier is the precision
+ * modifier for the floating point and exponential formats. The decimal point and other locale
+ * dependent formatting is done according to the graph locale.
+ *
+ * \sa AbstractGraph3D::locale
*/
/*!
@@ -164,12 +173,20 @@ int QValue3DAxis::subSegmentCount() const
/*!
* \property QValue3DAxis::labelFormat
*
- * Defines the label \a format to be used for the labels on this axis. Supported specifiers are:
+ * Defines the label format to be used for the labels on this axis. How the format is interpreted
+ * depends on the axis formatter and the locale in use. Using the default formatter and default
+ * locale (\c{"C"}), the formatting uses QString::sprintf(). Supported specifiers are:
* \c {d, i, o, x, X, f, F, e, E, g, G, c}. See QString::sprintf() for additional details.
+ * For other locales, the default formatter uses reduced set of printf format specifiers:
+ * \c {d, i, f, F, e, E, g, G}. In these cases, the only supported modifier is the precision
+ * modifier for the floating point and exponential formats. The decimal point and other locale
+ * dependent formatting is done according to the graph locale.
*
* Usage example:
*
* \c {axis->setLabelFormat("%.2f mm");}
+ *
+ * \sa formatter, QAbstract3DGraph::locale
*/
void QValue3DAxis::setLabelFormat(const QString &format)
{
@@ -201,6 +218,9 @@ void QValue3DAxis::setFormatter(QValue3DAxisFormatter *formatter)
dptr()->m_formatter = formatter;
formatter->setParent(this);
formatter->d_ptr->setAxis(this);
+ Abstract3DController *controller = qobject_cast<Abstract3DController *>(parent());
+ if (controller)
+ formatter->setLocale(controller->locale());
emit formatterChanged(formatter);
emit dptr()->formatterDirty();
}