1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the QtGraphs API. It exists purely as an
9// implementation detail. This header file may change from version to
10// version without notice, or even be removed.
11//
12// We mean it.
13
14#ifndef QABSTRACT3DSERIES_P_H
15#define QABSTRACT3DSERIES_P_H
16
17#include <QtCore/private/qobject_p.h>
18#include <private/qgraphsglobal_p.h>
19
20#include "qabstract3dseries.h"
21
22QT_BEGIN_NAMESPACE
23
24class QAbstractDataProxy;
25class QQuickGraphsItem;
26
27struct QAbstract3DSeriesChangeBitField
28{
29 bool meshChanged : 1;
30 bool meshSmoothChanged : 1;
31 bool meshRotationChanged : 1;
32 bool userDefinedMeshChanged : 1;
33 bool colorStyleChanged : 1;
34 bool baseColorChanged : 1;
35 bool baseGradientChanged : 1;
36 bool singleHighlightColorChanged : 1;
37 bool singleHighlightGradientChanged : 1;
38 bool multiHighlightColorChanged : 1;
39 bool multiHighlightGradientChanged : 1;
40 bool lightingModeChanged: 1;
41 bool nameChanged : 1;
42 bool itemLabelChanged : 1;
43 bool itemLabelVisibilityChanged : 1;
44 bool visibilityChanged : 1;
45
46 QAbstract3DSeriesChangeBitField()
47 : meshChanged(true)
48 , meshSmoothChanged(true)
49 , meshRotationChanged(true)
50 , userDefinedMeshChanged(true)
51 , colorStyleChanged(true)
52 , baseColorChanged(true)
53 , baseGradientChanged(true)
54 , singleHighlightColorChanged(true)
55 , singleHighlightGradientChanged(true)
56 , multiHighlightColorChanged(true)
57 , multiHighlightGradientChanged(true)
58 , lightingModeChanged(true)
59 , nameChanged(true)
60 , itemLabelChanged(true)
61 , itemLabelVisibilityChanged(true)
62 , visibilityChanged(true)
63 {}
64};
65
66struct QAbstract3DSeriesThemeOverrideBitField
67{
68 bool colorStyleOverride : 1;
69 bool baseColorOverride : 1;
70 bool baseGradientOverride : 1;
71 bool singleHighlightColorOverride : 1;
72 bool singleHighlightGradientOverride : 1;
73 bool multiHighlightColorOverride : 1;
74 bool multiHighlightGradientOverride : 1;
75
76 QAbstract3DSeriesThemeOverrideBitField()
77 : colorStyleOverride(false)
78 , baseColorOverride(false)
79 , baseGradientOverride(false)
80 , singleHighlightColorOverride(false)
81 , singleHighlightGradientOverride(false)
82 , multiHighlightColorOverride(false)
83 , multiHighlightGradientOverride(false)
84 {}
85};
86
87class QAbstract3DSeriesPrivate : public QObjectPrivate
88{
89 Q_DECLARE_PUBLIC(QAbstract3DSeries)
90
91public:
92 QAbstract3DSeriesPrivate(QAbstract3DSeries::SeriesType type);
93 ~QAbstract3DSeriesPrivate() override;
94
95 QAbstractDataProxy *dataProxy() const;
96 virtual void setDataProxy(QAbstractDataProxy *proxy);
97 virtual void setGraph(QQuickGraphsItem *graph);
98 virtual void connectGraphAndProxy(QQuickGraphsItem *newGraph) = 0;
99 virtual void createItemLabel() = 0;
100
101 void setItemLabelFormat(const QString &format);
102 void setVisible(bool visible);
103 void setMesh(QAbstract3DSeries::Mesh mesh);
104 void setMeshSmooth(bool enable);
105 void setMeshRotation(const QQuaternion &rotation);
106 void setUserDefinedMesh(const QString &meshFile);
107
108 void setColorStyle(QGraphsTheme::ColorStyle style);
109 void setBaseColor(QColor color);
110 void setBaseGradient(const QLinearGradient &gradient);
111 void setSingleHighlightColor(QColor color);
112 void setSingleHighlightGradient(const QLinearGradient &gradient);
113 void setMultiHighlightColor(QColor color);
114 void setMultiHighlightGradient(const QLinearGradient &gradient);
115 void setName(const QString &name);
116
117 void resetToTheme(const QGraphsTheme &theme, qsizetype seriesIndex, bool force);
118 QString itemLabel();
119 void markItemLabelDirty();
120 bool itemLabelDirty() const { return m_itemLabelDirty; }
121 void setItemLabelVisible(bool visible);
122 bool isUsingGradient();
123
124 void setLightingMode(QAbstract3DSeries::LightingMode mode);
125
126protected:
127 QAbstract3DSeriesChangeBitField m_changeTracker;
128 QAbstract3DSeriesThemeOverrideBitField m_themeTracker;
129 QAbstract3DSeries::SeriesType m_type;
130 QString m_itemLabelFormat;
131 QAbstractDataProxy *m_dataProxy;
132 bool m_visible;
133 QQuickGraphsItem *m_graph;
134 QAbstract3DSeries::Mesh m_mesh;
135 bool m_meshSmooth;
136 QQuaternion m_meshRotation;
137 QString m_userDefinedMesh;
138
139 QGraphsTheme::ColorStyle m_colorStyle;
140 QColor m_baseColor;
141 QLinearGradient m_baseGradient;
142 QColor m_singleHighlightColor;
143 QLinearGradient m_singleHighlightGradient;
144 QColor m_multiHighlightColor;
145 QLinearGradient m_multiHighlightGradient;
146
147 QString m_name;
148 QString m_itemLabel;
149 bool m_itemLabelDirty;
150 bool m_itemLabelVisible;
151
152 QAbstract3DSeries::LightingMode m_lightingMode;
153
154 friend class QQuickGraphsScatter;
155 friend class QQuickGraphsSurface;
156 friend class QQuickGraphsBars;
157 friend class QQuickGraphsItem;
158};
159
160QT_END_NAMESPACE
161
162#endif
163

source code of qtgraphs/src/graphs3d/data/qabstract3dseries_p.h