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 <QtGraphs/q3dtheme.h> |
8 | #include <QtCore/QObject> |
9 | #include <QtCore/QScopedPointer> |
10 | #include <QtCore/QString> |
11 | #include <QtGui/QLinearGradient> |
12 | #include <QtGui/QQuaternion> |
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_PROPERTY(QAbstract3DSeries::SeriesType type READ type CONSTANT) |
23 | Q_PROPERTY(QString itemLabelFormat READ itemLabelFormat WRITE setItemLabelFormat NOTIFY itemLabelFormatChanged) |
24 | Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibilityChanged) |
25 | Q_PROPERTY(QAbstract3DSeries::Mesh mesh READ mesh WRITE setMesh NOTIFY meshChanged) |
26 | Q_PROPERTY(bool meshSmooth READ isMeshSmooth WRITE setMeshSmooth NOTIFY meshSmoothChanged) |
27 | Q_PROPERTY(QQuaternion meshRotation READ meshRotation WRITE setMeshRotation NOTIFY meshRotationChanged) |
28 | Q_PROPERTY(QString userDefinedMesh READ userDefinedMesh WRITE setUserDefinedMesh NOTIFY userDefinedMeshChanged) |
29 | Q_PROPERTY(Q3DTheme::ColorStyle colorStyle READ colorStyle WRITE setColorStyle NOTIFY colorStyleChanged) |
30 | Q_PROPERTY(QColor baseColor READ baseColor WRITE setBaseColor NOTIFY baseColorChanged) |
31 | Q_PROPERTY(QLinearGradient baseGradient READ baseGradient WRITE setBaseGradient NOTIFY baseGradientChanged) |
32 | Q_PROPERTY(QColor singleHighlightColor READ singleHighlightColor WRITE setSingleHighlightColor NOTIFY singleHighlightColorChanged) |
33 | Q_PROPERTY(QLinearGradient singleHighlightGradient READ singleHighlightGradient WRITE setSingleHighlightGradient NOTIFY singleHighlightGradientChanged) |
34 | Q_PROPERTY(QColor multiHighlightColor READ multiHighlightColor WRITE setMultiHighlightColor NOTIFY multiHighlightColorChanged) |
35 | Q_PROPERTY(QLinearGradient multiHighlightGradient READ multiHighlightGradient WRITE setMultiHighlightGradient NOTIFY multiHighlightGradientChanged) |
36 | Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) |
37 | Q_PROPERTY(QString itemLabel READ itemLabel NOTIFY itemLabelChanged) |
38 | Q_PROPERTY(bool itemLabelVisible READ isItemLabelVisible WRITE setItemLabelVisible NOTIFY itemLabelVisibilityChanged) |
39 | |
40 | public: |
41 | enum SeriesType { |
42 | SeriesTypeNone = 0, |
43 | SeriesTypeBar = 1, |
44 | SeriesTypeScatter = 2, |
45 | SeriesTypeSurface = 4 |
46 | }; |
47 | Q_ENUM(SeriesType) |
48 | |
49 | enum Mesh { |
50 | MeshUserDefined = 0, |
51 | MeshBar, |
52 | MeshCube, |
53 | MeshPyramid, |
54 | MeshCone, |
55 | MeshCylinder, |
56 | MeshBevelBar, |
57 | MeshBevelCube, |
58 | MeshSphere, |
59 | MeshMinimal, |
60 | MeshArrow, |
61 | MeshPoint |
62 | }; |
63 | Q_ENUM(Mesh) |
64 | |
65 | protected: |
66 | explicit QAbstract3DSeries(QAbstract3DSeriesPrivate *d, QObject *parent = nullptr); |
67 | |
68 | public: |
69 | virtual ~QAbstract3DSeries(); |
70 | |
71 | QAbstract3DSeries::SeriesType type() const; |
72 | |
73 | void setItemLabelFormat(const QString &format); |
74 | QString itemLabelFormat() const; |
75 | |
76 | void setVisible(bool visible); |
77 | bool isVisible() const; |
78 | |
79 | void setMesh(QAbstract3DSeries::Mesh mesh); |
80 | QAbstract3DSeries::Mesh mesh() const; |
81 | |
82 | void setMeshSmooth(bool enable); |
83 | bool isMeshSmooth() const; |
84 | |
85 | void setMeshRotation(const QQuaternion &rotation); |
86 | QQuaternion meshRotation() const; |
87 | Q_INVOKABLE void setMeshAxisAndAngle(const QVector3D &axis, float angle); |
88 | |
89 | void setUserDefinedMesh(const QString &fileName); |
90 | QString userDefinedMesh() const; |
91 | |
92 | void setColorStyle(Q3DTheme::ColorStyle style); |
93 | Q3DTheme::ColorStyle colorStyle() const; |
94 | void setBaseColor(const QColor &color); |
95 | QColor baseColor() const; |
96 | void setBaseGradient(const QLinearGradient &gradient); |
97 | QLinearGradient baseGradient() const; |
98 | void setSingleHighlightColor(const QColor &color); |
99 | QColor singleHighlightColor() const; |
100 | void setSingleHighlightGradient(const QLinearGradient &gradient); |
101 | QLinearGradient singleHighlightGradient() const; |
102 | void setMultiHighlightColor(const QColor &color); |
103 | QColor multiHighlightColor() const; |
104 | void setMultiHighlightGradient(const QLinearGradient &gradient); |
105 | QLinearGradient multiHighlightGradient() const; |
106 | |
107 | void setName(const QString &name); |
108 | QString name() const; |
109 | |
110 | QString itemLabel(); |
111 | void setItemLabelVisible(bool visible); |
112 | bool isItemLabelVisible() const; |
113 | |
114 | Q_SIGNALS: |
115 | void itemLabelFormatChanged(const QString &format); |
116 | void visibilityChanged(bool visible); |
117 | void meshChanged(QAbstract3DSeries::Mesh mesh); |
118 | void meshSmoothChanged(bool enabled); |
119 | void meshRotationChanged(const QQuaternion &rotation); |
120 | void userDefinedMeshChanged(const QString &fileName); |
121 | void colorStyleChanged(Q3DTheme::ColorStyle style); |
122 | void baseColorChanged(const QColor &color); |
123 | void baseGradientChanged(const QLinearGradient &gradient); |
124 | void singleHighlightColorChanged(const QColor &color); |
125 | void singleHighlightGradientChanged(const QLinearGradient &gradient); |
126 | void multiHighlightColorChanged(const QColor &color); |
127 | void multiHighlightGradientChanged(const QLinearGradient &gradient); |
128 | void nameChanged(const QString &name); |
129 | void itemLabelChanged(const QString &label); |
130 | void itemLabelVisibilityChanged(bool visible); |
131 | |
132 | protected: |
133 | QScopedPointer<QAbstract3DSeriesPrivate> d_ptr; |
134 | |
135 | private: |
136 | Q_DISABLE_COPY(QAbstract3DSeries) |
137 | |
138 | friend class Abstract3DController; |
139 | friend class Bars3DController; |
140 | friend class Surface3DController; |
141 | friend class Scatter3DController; |
142 | }; |
143 | |
144 | QT_END_NAMESPACE |
145 | |
146 | #endif |
147 | |