1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Data Visualization module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 or (at your option) any later version
20** approved by the KDE Free Qt Foundation. The licenses are as published by
21** the Free Software Foundation and appearing in the file LICENSE.GPL3
22** included in the packaging of this file. Please review the following
23** information to ensure the GNU General Public License requirements will
24** be met: https://www.gnu.org/licenses/gpl-3.0.html.
25**
26** $QT_END_LICENSE$
27**
28****************************************************************************/
29
30#ifndef QVALUE3DAXISFORMATTER_H
31#define QVALUE3DAXISFORMATTER_H
32
33#include <QtDataVisualization/qdatavisualizationglobal.h>
34#include <QtCore/QObject>
35#include <QtCore/QScopedPointer>
36#include <QtCore/QVector>
37#include <QtCore/QStringList>
38#include <QtCore/QLocale>
39
40QT_BEGIN_NAMESPACE_DATAVISUALIZATION
41
42class QValue3DAxisFormatterPrivate;
43class QValue3DAxis;
44
45class QT_DATAVISUALIZATION_EXPORT QValue3DAxisFormatter : public QObject
46{
47 Q_OBJECT
48protected:
49 explicit QValue3DAxisFormatter(QValue3DAxisFormatterPrivate *d, QObject *parent = nullptr);
50public:
51 explicit QValue3DAxisFormatter(QObject *parent = nullptr);
52 virtual ~QValue3DAxisFormatter();
53
54protected:
55 void setAllowNegatives(bool allow);
56 bool allowNegatives() const;
57 void setAllowZero(bool allow);
58 bool allowZero() const;
59
60 virtual QValue3DAxisFormatter *createNewInstance() const;
61 virtual void recalculate();
62 virtual QString stringForValue(qreal value, const QString &format) const;
63 virtual float positionAt(float value) const;
64 virtual float valueAt(float position) const;
65 virtual void populateCopy(QValue3DAxisFormatter &copy) const;
66
67 void markDirty(bool labelsChange = false);
68 QValue3DAxis *axis() const;
69
70 QVector<float> &gridPositions() const;
71 QVector<float> &subGridPositions() const;
72 QVector<float> &labelPositions() const;
73 QStringList &labelStrings() const;
74
75 void setLocale(const QLocale &locale);
76 QLocale locale() const;
77
78 QScopedPointer<QValue3DAxisFormatterPrivate> d_ptr;
79
80private:
81 Q_DISABLE_COPY(QValue3DAxisFormatter)
82
83 friend class Abstract3DController;
84 friend class Abstract3DRenderer;
85 friend class Bars3DRenderer;
86 friend class Scatter3DRenderer;
87 friend class Surface3DRenderer;
88 friend class SurfaceObject;
89 friend class QValue3DAxisFormatterPrivate;
90 friend class QLogValue3DAxisFormatter;
91 friend class QValue3DAxis;
92 friend class QValue3DAxisPrivate;
93 friend class AxisRenderCache;
94 friend class QBar3DSeriesPrivate;
95 friend class QScatter3DSeriesPrivate;
96 friend class QSurface3DSeriesPrivate;
97};
98
99QT_END_NAMESPACE_DATAVISUALIZATION
100
101#endif
102

source code of qtdatavis3d/src/datavisualization/axis/qvalue3daxisformatter.h