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 <QtCore/qlist.h> |
8 | #include <QtCore/qlocale.h> |
9 | #include <QtCore/qobject.h> |
10 | #include <QtCore/qscopedpointer.h> |
11 | #include <QtCore/qstringlist.h> |
12 | #include <QtGraphs/qgraphsglobal.h> |
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 | |
27 | public: |
28 | explicit QValue3DAxisFormatter(QObject *parent = nullptr); |
29 | ~QValue3DAxisFormatter() override; |
30 | |
31 | private Q_SLOTS: |
32 | void markDirtyNoLabelChange(); |
33 | |
34 | protected: |
35 | void setAllowNegatives(bool allow); |
36 | bool allowNegatives() const; |
37 | void setAllowZero(bool allow); |
38 | bool allowZero() const; |
39 | void setAxis(QValue3DAxis *axis); |
40 | |
41 | virtual QValue3DAxisFormatter *createNewInstance() const; |
42 | virtual void recalculate(); |
43 | virtual QString stringForValue(qreal value, const QString &format); |
44 | virtual float positionAt(float value) const; |
45 | virtual float valueAt(float position) const; |
46 | virtual void populateCopy(QValue3DAxisFormatter ©); |
47 | |
48 | void markDirty(bool labelsChange = false); |
49 | QValue3DAxis *axis() const; |
50 | |
51 | const QList<float> &gridPositions() const &; |
52 | QList<float> gridPositions() &&; |
53 | void setGridPoitions(QList<float> gridPositions); |
54 | const QList<float> &subGridPositions() const &; |
55 | QList<float> subGridPositions() &&; |
56 | void setSubGridPositions(QList<float> subGridPositions); |
57 | const QList<float> &labelPositions() const &; |
58 | QList<float> labelPositions() &&; |
59 | void setlabelPositions(QList<float> labelPositions); |
60 | const QStringList &labelStrings() const &; |
61 | QStringList labelStrings() &&; |
62 | void setLabelStrings(QStringList labelStrings); |
63 | |
64 | void setLocale(const QLocale &locale); |
65 | QLocale locale() const; |
66 | |
67 | private: |
68 | Q_DISABLE_COPY(QValue3DAxisFormatter) |
69 | |
70 | friend class QValue3DAxis; |
71 | friend class QValue3DAxisPrivate; |
72 | friend class QBar3DSeriesPrivate; |
73 | friend class QScatter3DSeriesPrivate; |
74 | friend class QSurface3DSeriesPrivate; |
75 | friend class QQuickGraphsItem; |
76 | friend class QQuickGraphsScatter; |
77 | friend class QQuickGraphsBars; |
78 | }; |
79 | |
80 | QT_END_NAMESPACE |
81 | |
82 | #endif |
83 | |