1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QVALUE3DAXISFORMATTER_H
5#define QVALUE3DAXISFORMATTER_H
6
7#include <QtDataVisualization/qdatavisualizationglobal.h>
8#include <QtCore/QList>
9#include <QtCore/QLocale>
10#include <QtCore/QObject>
11#include <QtCore/QScopedPointer>
12#include <QtCore/QStringList>
13
14QT_BEGIN_NAMESPACE
15
16class QValue3DAxisFormatterPrivate;
17class QValue3DAxis;
18
19class Q_DATAVISUALIZATION_EXPORT QValue3DAxisFormatter : public QObject
20{
21 Q_OBJECT
22protected:
23 explicit QValue3DAxisFormatter(QValue3DAxisFormatterPrivate *d, QObject *parent = nullptr);
24public:
25 explicit QValue3DAxisFormatter(QObject *parent = nullptr);
26 virtual ~QValue3DAxisFormatter();
27
28protected:
29 void setAllowNegatives(bool allow);
30 bool allowNegatives() const;
31 void setAllowZero(bool allow);
32 bool allowZero() const;
33
34 virtual QValue3DAxisFormatter *createNewInstance() const;
35 virtual void recalculate();
36 virtual QString stringForValue(qreal value, const QString &format) const;
37 virtual float positionAt(float value) const;
38 virtual float valueAt(float position) const;
39 virtual void populateCopy(QValue3DAxisFormatter &copy) const;
40
41 void markDirty(bool labelsChange = false);
42 QValue3DAxis *axis() const;
43
44 QList<float> &gridPositions() const;
45 QList<float> &subGridPositions() const;
46 QList<float> &labelPositions() const;
47 QStringList &labelStrings() const;
48
49 void setLocale(const QLocale &locale);
50 QLocale locale() const;
51
52 QScopedPointer<QValue3DAxisFormatterPrivate> d_ptr;
53
54private:
55 Q_DISABLE_COPY(QValue3DAxisFormatter)
56
57 friend class Abstract3DController;
58 friend class Abstract3DRenderer;
59 friend class Bars3DRenderer;
60 friend class Scatter3DRenderer;
61 friend class Surface3DRenderer;
62 friend class SurfaceObject;
63 friend class QValue3DAxisFormatterPrivate;
64 friend class QLogValue3DAxisFormatter;
65 friend class QValue3DAxis;
66 friend class QValue3DAxisPrivate;
67 friend class AxisRenderCache;
68 friend class QBar3DSeriesPrivate;
69 friend class QScatter3DSeriesPrivate;
70 friend class QSurface3DSeriesPrivate;
71};
72
73QT_END_NAMESPACE
74
75#endif
76

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