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 nameChanged : 1;
41 bool itemLabelChanged : 1;
42 bool itemLabelVisibilityChanged : 1;
43 bool visibilityChanged : 1;
44
45 QAbstract3DSeriesChangeBitField()
46 : meshChanged(true)
47 , meshSmoothChanged(true)
48 , meshRotationChanged(true)
49 , userDefinedMeshChanged(true)
50 , colorStyleChanged(true)
51 , baseColorChanged(true)
52 , baseGradientChanged(true)
53 , singleHighlightColorChanged(true)
54 , singleHighlightGradientChanged(true)
55 , multiHighlightColorChanged(true)
56 , multiHighlightGradientChanged(true)
57 , nameChanged(true)
58 , itemLabelChanged(true)
59 , itemLabelVisibilityChanged(true)
60 , visibilityChanged(true)
61 {}
62};
63
64struct QAbstract3DSeriesThemeOverrideBitField
65{
66 bool colorStyleOverride : 1;
67 bool baseColorOverride : 1;
68 bool baseGradientOverride : 1;
69 bool singleHighlightColorOverride : 1;
70 bool singleHighlightGradientOverride : 1;
71 bool multiHighlightColorOverride : 1;
72 bool multiHighlightGradientOverride : 1;
73
74 QAbstract3DSeriesThemeOverrideBitField()
75 : colorStyleOverride(false)
76 , baseColorOverride(false)
77 , baseGradientOverride(false)
78 , singleHighlightColorOverride(false)
79 , singleHighlightGradientOverride(false)
80 , multiHighlightColorOverride(false)
81 , multiHighlightGradientOverride(false)
82 {}
83};
84
85class QAbstract3DSeriesPrivate : public QObjectPrivate
86{
87 Q_DECLARE_PUBLIC(QAbstract3DSeries)
88
89public:
90 QAbstract3DSeriesPrivate(QAbstract3DSeries::SeriesType type);
91 ~QAbstract3DSeriesPrivate() override;
92
93 QAbstractDataProxy *dataProxy() const;
94 virtual void setDataProxy(QAbstractDataProxy *proxy);
95 virtual void setGraph(QQuickGraphsItem *graph);
96 virtual void connectGraphAndProxy(QQuickGraphsItem *newGraph) = 0;
97 virtual void createItemLabel() = 0;
98
99 void setItemLabelFormat(const QString &format);
100 void setVisible(bool visible);
101 void setMesh(QAbstract3DSeries::Mesh mesh);
102 void setMeshSmooth(bool enable);
103 void setMeshRotation(const QQuaternion &rotation);
104 void setUserDefinedMesh(const QString &meshFile);
105
106 void setColorStyle(QGraphsTheme::ColorStyle style);
107 void setBaseColor(QColor color);
108 void setBaseGradient(const QLinearGradient &gradient);
109 void setSingleHighlightColor(QColor color);
110 void setSingleHighlightGradient(const QLinearGradient &gradient);
111 void setMultiHighlightColor(QColor color);
112 void setMultiHighlightGradient(const QLinearGradient &gradient);
113 void setName(const QString &name);
114
115 void resetToTheme(const QGraphsTheme &theme, qsizetype seriesIndex, bool force);
116 QString itemLabel();
117 void markItemLabelDirty();
118 bool itemLabelDirty() const { return m_itemLabelDirty; }
119 void setItemLabelVisible(bool visible);
120 bool isUsingGradient();
121
122protected:
123 QAbstract3DSeriesChangeBitField m_changeTracker;
124 QAbstract3DSeriesThemeOverrideBitField m_themeTracker;
125 QAbstract3DSeries::SeriesType m_type;
126 QString m_itemLabelFormat;
127 QAbstractDataProxy *m_dataProxy;
128 bool m_visible;
129 QQuickGraphsItem *m_graph;
130 QAbstract3DSeries::Mesh m_mesh;
131 bool m_meshSmooth;
132 QQuaternion m_meshRotation;
133 QString m_userDefinedMesh;
134
135 QGraphsTheme::ColorStyle m_colorStyle;
136 QColor m_baseColor;
137 QLinearGradient m_baseGradient;
138 QColor m_singleHighlightColor;
139 QLinearGradient m_singleHighlightGradient;
140 QColor m_multiHighlightColor;
141 QLinearGradient m_multiHighlightGradient;
142
143 QString m_name;
144 QString m_itemLabel;
145 bool m_itemLabelDirty;
146 bool m_itemLabelVisible;
147
148 friend class QQuickGraphsScatter;
149 friend class QQuickGraphsSurface;
150 friend class QQuickGraphsBars;
151 friend class QQuickGraphsItem;
152};
153
154QT_END_NAMESPACE
155
156#endif
157

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

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