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/qobject.h> |
8 | #include <QtCore/qscopedpointer.h> |
9 | #include <QtCore/qstringlist.h> |
10 | #include <QtCore/qtclasshelpermacros.h> |
11 | #include <QtGraphs/qgraphsglobal.h> |
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_CLASSINFO("RegisterEnumClassesUnscoped" , "false" ) |
22 | Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL) |
23 | Q_PROPERTY(QStringList labels READ labels WRITE setLabels NOTIFY labelsChanged) |
24 | Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY |
25 | labelVisibleChanged FINAL) |
26 | Q_PROPERTY(QAbstract3DAxis::AxisOrientation orientation READ orientation NOTIFY |
27 | orientationChanged FINAL) |
28 | Q_PROPERTY(QAbstract3DAxis::AxisType type READ type CONSTANT) |
29 | Q_PROPERTY(float min READ min WRITE setMin NOTIFY minChanged FINAL) |
30 | Q_PROPERTY(float max READ max WRITE setMax NOTIFY maxChanged FINAL) |
31 | Q_PROPERTY(bool autoAdjustRange READ isAutoAdjustRange WRITE setAutoAdjustRange NOTIFY |
32 | autoAdjustRangeChanged FINAL) |
33 | Q_PROPERTY(float labelAutoAngle READ labelAutoAngle WRITE setLabelAutoAngle NOTIFY |
34 | labelAutoAngleChanged FINAL) |
35 | Q_PROPERTY(bool titleVisible READ isTitleVisible WRITE setTitleVisible NOTIFY |
36 | titleVisibleChanged FINAL) |
37 | Q_PROPERTY(bool titleFixed READ isTitleFixed WRITE setTitleFixed NOTIFY titleFixedChanged FINAL) |
38 | Q_PROPERTY( |
39 | float titleOffset READ titleOffset WRITE setTitleOffset NOTIFY titleOffsetChanged FINAL) |
40 | |
41 | public: |
42 | enum class AxisOrientation { None, X, Y, Z }; |
43 | Q_ENUM(AxisOrientation) |
44 | |
45 | enum class AxisType { |
46 | None, |
47 | Category, |
48 | Value, |
49 | }; |
50 | Q_ENUM(AxisType) |
51 | |
52 | protected: |
53 | explicit QAbstract3DAxis(QAbstract3DAxisPrivate &d, QObject *parent = nullptr); |
54 | |
55 | public: |
56 | ~QAbstract3DAxis() override; |
57 | |
58 | void setTitle(const QString &title); |
59 | QString title() const; |
60 | |
61 | void setLabels(const QStringList &labels); |
62 | QStringList labels() const; |
63 | |
64 | QAbstract3DAxis::AxisOrientation orientation() const; |
65 | QAbstract3DAxis::AxisType type() const; |
66 | |
67 | void setMin(float min); |
68 | float min() const; |
69 | |
70 | void setMax(float max); |
71 | float max() const; |
72 | |
73 | void setAutoAdjustRange(bool autoAdjust); |
74 | bool isAutoAdjustRange() const; |
75 | |
76 | void setRange(float min, float max); |
77 | |
78 | void setLabelAutoAngle(float degree); |
79 | float labelAutoAngle() const; |
80 | |
81 | void setTitleVisible(bool visible); |
82 | bool isTitleVisible() const; |
83 | |
84 | void setLabelsVisible(bool visible); |
85 | bool labelsVisible() const; |
86 | |
87 | void setTitleFixed(bool fixed); |
88 | bool isTitleFixed() const; |
89 | |
90 | void setTitleOffset(float offset); |
91 | float titleOffset() const; |
92 | |
93 | Q_SIGNALS: |
94 | void titleChanged(const QString &newTitle); |
95 | void labelsChanged(); |
96 | void orientationChanged(QAbstract3DAxis::AxisOrientation orientation); |
97 | void minChanged(float value); |
98 | void maxChanged(float value); |
99 | void rangeChanged(float min, float max); |
100 | void autoAdjustRangeChanged(bool autoAdjust); |
101 | void labelAutoAngleChanged(float angle); |
102 | void titleVisibleChanged(bool visible); |
103 | void labelVisibleChanged(bool visible); |
104 | void titleFixedChanged(bool fixed); |
105 | void titleOffsetChanged(float offset); |
106 | |
107 | private: |
108 | Q_DISABLE_COPY(QAbstract3DAxis) |
109 | |
110 | friend class QQuickGraphsItem; |
111 | friend class QScatterDataProxyPrivate; |
112 | friend class QSurfaceDataProxyPrivate; |
113 | }; |
114 | |
115 | QT_END_NAMESPACE |
116 | |
117 | #endif |
118 | |