1 | // Copyright (C) 2023 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 <QtGraphs/qgraphsglobal.h> |
8 | #include <QtCore/QList> |
9 | #include <QtCore/QLocale> |
10 | #include <QtCore/QObject> |
11 | #include <QtCore/QScopedPointer> |
12 | #include <QtCore/QStringList> |
13 | |
14 | QT_BEGIN_NAMESPACE |
15 | |
16 | class QValue3DAxisFormatterPrivate; |
17 | class QValue3DAxis; |
18 | |
19 | class Q_GRAPHS_EXPORT QValue3DAxisFormatter : public QObject |
20 | { |
21 | Q_OBJECT |
22 | Q_DECLARE_PRIVATE(QValue3DAxisFormatter) |
23 | |
24 | protected: |
25 | explicit QValue3DAxisFormatter(QValue3DAxisFormatterPrivate *d, QObject *parent = nullptr); |
26 | public: |
27 | explicit QValue3DAxisFormatter(QObject *parent = nullptr); |
28 | virtual ~QValue3DAxisFormatter(); |
29 | |
30 | private Q_SLOTS: |
31 | void markDirtyNoLabelChange(); |
32 | |
33 | protected: |
34 | void setAllowNegatives(bool allow); |
35 | bool allowNegatives() const; |
36 | void setAllowZero(bool allow); |
37 | bool allowZero() const; |
38 | void setAxis(QValue3DAxis *axis); |
39 | |
40 | virtual QValue3DAxisFormatter *createNewInstance() const; |
41 | virtual void recalculate(); |
42 | virtual QString stringForValue(qreal value, const QString &format); |
43 | virtual float positionAt(float value) const; |
44 | virtual float valueAt(float position) const; |
45 | virtual void populateCopy(QValue3DAxisFormatter ©); |
46 | |
47 | void markDirty(bool labelsChange = false); |
48 | QValue3DAxis *axis() const; |
49 | |
50 | QList<float> &gridPositions(); |
51 | QList<float> &subGridPositions(); |
52 | QList<float> &labelPositions(); |
53 | QStringList &labelStrings(); |
54 | |
55 | void setLocale(const QLocale &locale); |
56 | QLocale locale() const; |
57 | |
58 | QScopedPointer<QValue3DAxisFormatterPrivate> d_ptr; |
59 | |
60 | private: |
61 | Q_DISABLE_COPY(QValue3DAxisFormatter) |
62 | |
63 | friend class Abstract3DController; |
64 | friend class QValue3DAxisFormatterPrivate; |
65 | friend class QValue3DAxis; |
66 | friend class QValue3DAxisPrivate; |
67 | friend class AxisHelper; |
68 | friend class QBar3DSeriesPrivate; |
69 | friend class QScatter3DSeriesPrivate; |
70 | friend class QSurface3DSeriesPrivate; |
71 | friend class QQuickGraphsItem; |
72 | friend class QQuickGraphsScatter; |
73 | friend class QQuickGraphsBars; |
74 | }; |
75 | |
76 | QT_END_NAMESPACE |
77 | |
78 | #endif |
79 |