1 | // Copyright (C) 2023 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QABSTRACT3DAXIS_H |
5 | #define QABSTRACT3DAXIS_H |
6 | |
7 | #include <QtCore/qtclasshelpermacros.h> |
8 | #include <QtGraphs/qgraphsglobal.h> |
9 | #include <QtCore/QObject> |
10 | #include <QtCore/QScopedPointer> |
11 | #include <QtCore/QStringList> |
12 | |
13 | QT_BEGIN_NAMESPACE |
14 | |
15 | class QAbstract3DAxisPrivate; |
16 | |
17 | class Q_GRAPHS_EXPORT QAbstract3DAxis : public QObject |
18 | { |
19 | Q_OBJECT |
20 | Q_DECLARE_PRIVATE(QAbstract3DAxis) |
21 | Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged) |
22 | Q_PROPERTY(QStringList labels READ labels WRITE setLabels NOTIFY labelsChanged) |
23 | Q_PROPERTY(QAbstract3DAxis::AxisOrientation orientation READ orientation NOTIFY orientationChanged) |
24 | Q_PROPERTY(QAbstract3DAxis::AxisType type READ type CONSTANT) |
25 | Q_PROPERTY(float min READ min WRITE setMin NOTIFY minChanged) |
26 | Q_PROPERTY(float max READ max WRITE setMax NOTIFY maxChanged) |
27 | Q_PROPERTY(bool autoAdjustRange READ isAutoAdjustRange WRITE setAutoAdjustRange NOTIFY autoAdjustRangeChanged) |
28 | Q_PROPERTY(float labelAutoRotation READ labelAutoRotation WRITE setLabelAutoRotation NOTIFY labelAutoRotationChanged) |
29 | Q_PROPERTY(bool titleVisible READ isTitleVisible WRITE setTitleVisible NOTIFY titleVisibilityChanged) |
30 | Q_PROPERTY(bool titleFixed READ isTitleFixed WRITE setTitleFixed NOTIFY titleFixedChanged) |
31 | |
32 | public: |
33 | enum AxisOrientation { |
34 | AxisOrientationNone = 0, |
35 | AxisOrientationX = 1, |
36 | AxisOrientationY = 2, |
37 | AxisOrientationZ = 4 |
38 | }; |
39 | Q_ENUM(AxisOrientation) |
40 | |
41 | enum AxisType { |
42 | AxisTypeNone = 0, |
43 | AxisTypeCategory = 1, |
44 | AxisTypeValue = 2 |
45 | }; |
46 | Q_ENUM(AxisType) |
47 | |
48 | protected: |
49 | explicit QAbstract3DAxis(QAbstract3DAxisPrivate *d, QObject *parent = nullptr); |
50 | |
51 | public: |
52 | virtual ~QAbstract3DAxis(); |
53 | |
54 | void setTitle(const QString &title); |
55 | QString title() const; |
56 | |
57 | void setLabels(const QStringList &labels); |
58 | QStringList labels() const; |
59 | |
60 | QAbstract3DAxis::AxisOrientation orientation() const; |
61 | QAbstract3DAxis::AxisType type() const; |
62 | |
63 | void setMin(float min); |
64 | float min() const; |
65 | |
66 | void setMax(float max); |
67 | float max() const; |
68 | |
69 | void setAutoAdjustRange(bool autoAdjust); |
70 | bool isAutoAdjustRange() const; |
71 | |
72 | void setRange(float min, float max); |
73 | |
74 | void setLabelAutoRotation(float angle); |
75 | float labelAutoRotation() const; |
76 | |
77 | void setTitleVisible(bool visible); |
78 | bool isTitleVisible() const; |
79 | |
80 | void setTitleFixed(bool fixed); |
81 | bool isTitleFixed() const; |
82 | |
83 | Q_SIGNALS: |
84 | void titleChanged(const QString &newTitle); |
85 | void labelsChanged(); |
86 | void orientationChanged(QAbstract3DAxis::AxisOrientation orientation); |
87 | void minChanged(float value); |
88 | void maxChanged(float value); |
89 | void rangeChanged(float min, float max); |
90 | void autoAdjustRangeChanged(bool autoAdjust); |
91 | void labelAutoRotationChanged(float angle); |
92 | void titleVisibilityChanged(bool visible); |
93 | void titleFixedChanged(bool fixed); |
94 | |
95 | protected: |
96 | QScopedPointer<QAbstract3DAxisPrivate> d_ptr; |
97 | |
98 | private: |
99 | Q_DISABLE_COPY(QAbstract3DAxis) |
100 | |
101 | friend class Abstract3DController; |
102 | friend class QScatterDataProxyPrivate; |
103 | friend class QSurfaceDataProxyPrivate; |
104 | }; |
105 | |
106 | QT_END_NAMESPACE |
107 | |
108 | #endif |
109 | |