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(int segmentCount READ segmentCount WRITE setSegmentCount NOTIFY segmentCountChanged) |
19 | Q_PROPERTY(int subSegmentCount READ subSegmentCount WRITE setSubSegmentCount NOTIFY subSegmentCountChanged) |
20 | Q_PROPERTY(QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged) |
21 | Q_PROPERTY(QValue3DAxisFormatter* formatter READ formatter WRITE setFormatter NOTIFY formatterChanged) |
22 | Q_PROPERTY(bool reversed READ reversed WRITE setReversed NOTIFY reversedChanged) |
23 | |
24 | public: |
25 | explicit QValue3DAxis(QObject *parent = nullptr); |
26 | virtual ~QValue3DAxis(); |
27 | |
28 | void setSegmentCount(int count); |
29 | int segmentCount() const; |
30 | |
31 | void setSubSegmentCount(int count); |
32 | int subSegmentCount() const; |
33 | |
34 | void setLabelFormat(const QString &format); |
35 | QString labelFormat() const; |
36 | |
37 | void setFormatter(QValue3DAxisFormatter *formatter); |
38 | QValue3DAxisFormatter *formatter() const; |
39 | |
40 | void setReversed(bool enable); |
41 | bool reversed() const; |
42 | |
43 | void recalculate(); |
44 | int gridSize(); |
45 | int subGridSize(); |
46 | float gridPositionAt(int gridLine); |
47 | float subGridPositionAt(int gridLine); |
48 | float labelPositionAt(int index); |
49 | float positionAt(float x); |
50 | QString stringForValue(float x); |
51 | |
52 | Q_SIGNALS: |
53 | void segmentCountChanged(int count); |
54 | void subSegmentCountChanged(int count); |
55 | void labelFormatChanged(const QString &format); |
56 | void formatterChanged(QValue3DAxisFormatter *formatter); |
57 | void reversedChanged(bool enable); |
58 | void formatterDirty(); |
59 | |
60 | private: |
61 | Q_DISABLE_COPY(QValue3DAxis) |
62 | friend class Abstract3DController; |
63 | friend class Bars3DController; |
64 | friend class Scatter3DController; |
65 | friend class Surface3DController; |
66 | friend class QValue3DAxisFormatterPrivate; |
67 | }; |
68 | |
69 | QT_END_NAMESPACE |
70 | |
71 | #endif |
72 | |