1 | // Copyright (C) 2023 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QABSTRACT3DSERIES_H |
5 | #define QABSTRACT3DSERIES_H |
6 | |
7 | #include <QtCore/qobject.h> |
8 | #include <QtCore/qscopedpointer.h> |
9 | #include <QtCore/qstring.h> |
10 | #include <QtGraphs/qgraphstheme.h> |
11 | #include <QtGui/qbrush.h> |
12 | #include <QtGui/qquaternion.h> |
13 | |
14 | QT_BEGIN_NAMESPACE |
15 | |
16 | class QAbstract3DSeriesPrivate; |
17 | |
18 | class Q_GRAPHS_EXPORT QAbstract3DSeries : public QObject |
19 | { |
20 | Q_OBJECT |
21 | Q_DECLARE_PRIVATE(QAbstract3DSeries) |
22 | Q_CLASSINFO("RegisterEnumClassesUnscoped" , "false" ) |
23 | Q_PROPERTY(QAbstract3DSeries::SeriesType type READ type CONSTANT) |
24 | Q_PROPERTY(QString itemLabelFormat READ itemLabelFormat WRITE setItemLabelFormat NOTIFY |
25 | itemLabelFormatChanged) |
26 | Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) |
27 | Q_PROPERTY(QAbstract3DSeries::Mesh mesh READ mesh WRITE setMesh NOTIFY meshChanged) |
28 | Q_PROPERTY(bool meshSmooth READ isMeshSmooth WRITE setMeshSmooth NOTIFY meshSmoothChanged) |
29 | Q_PROPERTY( |
30 | QQuaternion meshRotation READ meshRotation WRITE setMeshRotation NOTIFY meshRotationChanged) |
31 | Q_PROPERTY(QString userDefinedMesh READ userDefinedMesh WRITE setUserDefinedMesh NOTIFY |
32 | userDefinedMeshChanged) |
33 | Q_PROPERTY(QGraphsTheme::ColorStyle colorStyle READ colorStyle WRITE setColorStyle NOTIFY |
34 | colorStyleChanged) |
35 | Q_PROPERTY(QColor baseColor READ baseColor WRITE setBaseColor NOTIFY baseColorChanged) |
36 | Q_PROPERTY(QLinearGradient baseGradient READ baseGradient WRITE setBaseGradient NOTIFY |
37 | baseGradientChanged) |
38 | Q_PROPERTY(QColor singleHighlightColor READ singleHighlightColor WRITE setSingleHighlightColor |
39 | NOTIFY singleHighlightColorChanged) |
40 | Q_PROPERTY(QLinearGradient singleHighlightGradient READ singleHighlightGradient WRITE |
41 | setSingleHighlightGradient NOTIFY singleHighlightGradientChanged) |
42 | Q_PROPERTY(QColor multiHighlightColor READ multiHighlightColor WRITE setMultiHighlightColor |
43 | NOTIFY multiHighlightColorChanged) |
44 | Q_PROPERTY(QLinearGradient multiHighlightGradient READ multiHighlightGradient WRITE |
45 | setMultiHighlightGradient NOTIFY multiHighlightGradientChanged) |
46 | Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) |
47 | Q_PROPERTY(QString itemLabel READ itemLabel NOTIFY itemLabelChanged) |
48 | Q_PROPERTY(bool itemLabelVisible READ isItemLabelVisible WRITE setItemLabelVisible NOTIFY |
49 | itemLabelVisibleChanged) |
50 | |
51 | public: |
52 | enum class SeriesType { |
53 | None, |
54 | Bar, |
55 | Scatter, |
56 | Surface, |
57 | }; |
58 | Q_ENUM(SeriesType) |
59 | |
60 | enum class Mesh { |
61 | UserDefined, |
62 | Bar, |
63 | Cube, |
64 | Pyramid, |
65 | Cone, |
66 | Cylinder, |
67 | BevelBar, |
68 | BevelCube, |
69 | Sphere, |
70 | Minimal, |
71 | Arrow, |
72 | Point, |
73 | }; |
74 | Q_ENUM(Mesh) |
75 | |
76 | protected: |
77 | explicit QAbstract3DSeries(QAbstract3DSeriesPrivate &d, QObject *parent = nullptr); |
78 | |
79 | public: |
80 | ~QAbstract3DSeries() override; |
81 | |
82 | QAbstract3DSeries::SeriesType type() const; |
83 | |
84 | void setItemLabelFormat(const QString &format); |
85 | QString itemLabelFormat() const; |
86 | |
87 | void setVisible(bool visible); |
88 | bool isVisible() const; |
89 | |
90 | void setMesh(QAbstract3DSeries::Mesh mesh); |
91 | QAbstract3DSeries::Mesh mesh() const; |
92 | |
93 | void setMeshSmooth(bool enable); |
94 | bool isMeshSmooth() const; |
95 | |
96 | void setMeshRotation(const QQuaternion &rotation); |
97 | QQuaternion meshRotation() const; |
98 | Q_INVOKABLE void setMeshAxisAndAngle(QVector3D axis, float angle); |
99 | |
100 | void setUserDefinedMesh(const QString &fileName); |
101 | QString userDefinedMesh() const; |
102 | |
103 | void setColorStyle(QGraphsTheme::ColorStyle style); |
104 | QGraphsTheme::ColorStyle colorStyle() const; |
105 | void setBaseColor(QColor color); |
106 | QColor baseColor() const; |
107 | void setBaseGradient(const QLinearGradient &gradient); |
108 | QLinearGradient baseGradient() const; |
109 | void setSingleHighlightColor(QColor color); |
110 | QColor singleHighlightColor() const; |
111 | void setSingleHighlightGradient(const QLinearGradient &gradient); |
112 | QLinearGradient singleHighlightGradient() const; |
113 | void setMultiHighlightColor(QColor color); |
114 | QColor multiHighlightColor() const; |
115 | void setMultiHighlightGradient(const QLinearGradient &gradient); |
116 | QLinearGradient multiHighlightGradient() const; |
117 | |
118 | void setName(const QString &name); |
119 | QString name() const; |
120 | |
121 | QString itemLabel(); |
122 | void setItemLabelVisible(bool visible); |
123 | bool isItemLabelVisible() const; |
124 | |
125 | Q_SIGNALS: |
126 | void itemLabelFormatChanged(const QString &format); |
127 | void visibleChanged(bool visible); |
128 | void meshChanged(QAbstract3DSeries::Mesh mesh); |
129 | void meshSmoothChanged(bool enabled); |
130 | void meshRotationChanged(const QQuaternion &rotation); |
131 | void userDefinedMeshChanged(const QString &fileName); |
132 | void colorStyleChanged(QGraphsTheme::ColorStyle style); |
133 | void baseColorChanged(QColor color); |
134 | void baseGradientChanged(const QLinearGradient &gradient); |
135 | void singleHighlightColorChanged(QColor color); |
136 | void singleHighlightGradientChanged(const QLinearGradient &gradient); |
137 | void multiHighlightColorChanged(QColor color); |
138 | void multiHighlightGradientChanged(const QLinearGradient &gradient); |
139 | void nameChanged(const QString &name); |
140 | void itemLabelChanged(const QString &label); |
141 | void itemLabelVisibleChanged(bool visible); |
142 | |
143 | private: |
144 | Q_DISABLE_COPY(QAbstract3DSeries) |
145 | |
146 | friend class QQuickGraphsItem; |
147 | friend class QQuickGraphsBars; |
148 | friend class QQuickGraphsSurface; |
149 | friend class QQuickGraphsScatter; |
150 | }; |
151 | |
152 | QT_END_NAMESPACE |
153 | |
154 | #endif |
155 | |