1 | // Copyright (C) 2023 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QVALUE3DAXIS_H |
5 | #define QVALUE3DAXIS_H |
6 | |
7 | #include <QtGraphs/qabstract3daxis.h> |
8 | #include <QtGraphs/qvalue3daxisformatter.h> |
9 | |
10 | QT_BEGIN_NAMESPACE |
11 | |
12 | class QValue3DAxisPrivate; |
13 | |
14 | class Q_GRAPHS_EXPORT QValue3DAxis : public QAbstract3DAxis |
15 | { |
16 | Q_OBJECT |
17 | Q_DECLARE_PRIVATE(QValue3DAxis) |
18 | Q_PROPERTY(qsizetype segmentCount READ segmentCount WRITE setSegmentCount NOTIFY |
19 | segmentCountChanged FINAL) |
20 | Q_PROPERTY(qsizetype subSegmentCount READ subSegmentCount WRITE setSubSegmentCount NOTIFY |
21 | subSegmentCountChanged FINAL) |
22 | Q_PROPERTY( |
23 | QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged FINAL) |
24 | Q_PROPERTY(QValue3DAxisFormatter *formatter READ formatter WRITE setFormatter NOTIFY |
25 | formatterChanged FINAL) |
26 | Q_PROPERTY(bool reversed READ reversed WRITE setReversed NOTIFY reversedChanged FINAL) |
27 | |
28 | public: |
29 | explicit QValue3DAxis(QObject *parent = nullptr); |
30 | ~QValue3DAxis() override; |
31 | |
32 | void setSegmentCount(qsizetype count); |
33 | qsizetype segmentCount() const; |
34 | |
35 | void setSubSegmentCount(qsizetype count); |
36 | qsizetype subSegmentCount() const; |
37 | |
38 | void setLabelFormat(const QString &format); |
39 | QString labelFormat() const; |
40 | |
41 | void setFormatter(QValue3DAxisFormatter *formatter); |
42 | QValue3DAxisFormatter *formatter() const; |
43 | |
44 | void setReversed(bool enable); |
45 | bool reversed() const; |
46 | |
47 | void recalculate(); |
48 | qsizetype gridSize(); |
49 | qsizetype subGridSize(); |
50 | float gridPositionAt(qsizetype gridLine); |
51 | float subGridPositionAt(qsizetype gridLine); |
52 | float labelPositionAt(qsizetype index); |
53 | float positionAt(float x); |
54 | QString stringForValue(float x); |
55 | |
56 | Q_SIGNALS: |
57 | void segmentCountChanged(qsizetype count); |
58 | void subSegmentCountChanged(qsizetype count); |
59 | void labelFormatChanged(const QString &format); |
60 | void formatterChanged(QValue3DAxisFormatter *formatter); |
61 | void reversedChanged(bool enable); |
62 | void formatterDirty(); |
63 | |
64 | private: |
65 | Q_DISABLE_COPY(QValue3DAxis) |
66 | friend class QQuickGraphsItem; |
67 | friend class QQuickGraphsBars; |
68 | friend class QQuickGraphsScatter; |
69 | friend class QQuickGraphsSurface; |
70 | friend class QValue3DAxisFormatterPrivate; |
71 | }; |
72 | |
73 | QT_END_NAMESPACE |
74 | |
75 | #endif |
76 | |