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