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 Q3DTHEME_P_H |
15 | #define Q3DTHEME_P_H |
16 | |
17 | #include <private/graphsglobal_p.h> |
18 | #include "q3dtheme.h" |
19 | |
20 | QT_BEGIN_NAMESPACE |
21 | |
22 | struct Q3DThemeDirtyBitField { |
23 | bool ambientLightStrengthDirty : 1; |
24 | bool backgroundColorDirty : 1; |
25 | bool backgroundEnabledDirty : 1; |
26 | bool baseColorDirty : 1; |
27 | bool baseGradientDirty : 1; |
28 | bool colorStyleDirty : 1; |
29 | bool fontDirty : 1; |
30 | bool gridEnabledDirty : 1; |
31 | bool gridLineColorDirty : 1; |
32 | bool highlightLightStrengthDirty : 1; |
33 | bool labelBackgroundColorDirty : 1; |
34 | bool labelBackgroundEnabledDirty : 1; |
35 | bool labelBorderEnabledDirty : 1; |
36 | bool labelTextColorDirty : 1; |
37 | bool labelsEnabledDirty : 1; |
38 | bool lightColorDirty : 1; |
39 | bool lightStrengthDirty : 1; |
40 | bool multiHighlightColorDirty : 1; |
41 | bool multiHighlightGradientDirty : 1; |
42 | bool shadowStrengthDirty : 1; |
43 | bool singleHighlightColorDirty : 1; |
44 | bool singleHighlightGradientDirty : 1; |
45 | bool themeIdDirty : 1; |
46 | bool windowColorDirty : 1; |
47 | |
48 | Q3DThemeDirtyBitField() |
49 | : ambientLightStrengthDirty(false), |
50 | backgroundColorDirty(false), |
51 | backgroundEnabledDirty(false), |
52 | baseColorDirty(false), |
53 | baseGradientDirty(false), |
54 | colorStyleDirty(false), |
55 | fontDirty(false), |
56 | gridEnabledDirty(false), |
57 | gridLineColorDirty(false), |
58 | highlightLightStrengthDirty(false), |
59 | labelBackgroundColorDirty(false), |
60 | labelBackgroundEnabledDirty(false), |
61 | labelBorderEnabledDirty(false), |
62 | labelTextColorDirty(false), |
63 | labelsEnabledDirty(false), |
64 | lightColorDirty(false), |
65 | lightStrengthDirty(false), |
66 | multiHighlightColorDirty(false), |
67 | multiHighlightGradientDirty(false), |
68 | shadowStrengthDirty(false), |
69 | singleHighlightColorDirty(false), |
70 | singleHighlightGradientDirty(false), |
71 | themeIdDirty(false), |
72 | windowColorDirty(false) |
73 | { |
74 | } |
75 | }; |
76 | |
77 | class Q_GRAPHS_EXPORT Q3DThemePrivate : public QObject |
78 | { |
79 | Q_OBJECT |
80 | Q_DECLARE_PUBLIC(Q3DTheme) |
81 | |
82 | public: |
83 | Q3DThemePrivate(Q3DTheme *q); |
84 | virtual ~Q3DThemePrivate(); |
85 | |
86 | void resetDirtyBits(); |
87 | |
88 | bool sync(Q3DThemePrivate &other); |
89 | |
90 | inline bool isDefaultTheme() { return m_isDefaultTheme; } |
91 | inline void setDefaultTheme(bool isDefault) { m_isDefaultTheme = isDefault; } |
92 | |
93 | // If m_forcePredefinedType is true, it means we should forcibly update all properties |
94 | // of the theme to those of the predefined theme, when setting the theme type. Otherwise |
95 | // we only change the properties that haven't been explicitly changed since last render cycle. |
96 | // Defaults to true, and is only ever set to false by DeclarativeTheme3D to enable using |
97 | // predefined themes as base for custom themes, since the order of initial property sets cannot |
98 | // be easily controlled in QML. |
99 | inline bool isForcePredefinedType() { return m_forcePredefinedType; } |
100 | inline void setForcePredefinedType(bool enable) { m_forcePredefinedType = enable; } |
101 | |
102 | Q_SIGNALS: |
103 | void needRender(); |
104 | |
105 | public: |
106 | Q3DTheme::Theme m_themeId; |
107 | |
108 | Q3DThemeDirtyBitField m_dirtyBits; |
109 | |
110 | Q3DTheme::ColorStyle m_colorStyle; |
111 | QColor m_backgroundColor; |
112 | QColor m_gridLineColor; |
113 | QColor m_lightColor; |
114 | QColor m_multiHighlightColor; |
115 | QColor m_singleHighlightColor; |
116 | QColor m_textBackgroundColor; |
117 | QColor m_textColor; |
118 | QColor m_windowColor; |
119 | QFont m_font; |
120 | QLinearGradient m_multiHighlightGradient; |
121 | QLinearGradient m_singleHighlightGradient; |
122 | QList<QColor> m_baseColors; |
123 | QList<QLinearGradient> m_baseGradients; |
124 | bool m_backgoundEnabled; |
125 | bool m_forcePredefinedType; |
126 | bool m_gridEnabled; |
127 | bool m_isDefaultTheme; |
128 | bool m_labelBackground; |
129 | bool m_labelBorders; |
130 | bool m_labelsEnabled; |
131 | float m_ambientLightStrength; |
132 | float m_highlightLightStrength; |
133 | float m_lightStrength; |
134 | float m_shadowStrength; |
135 | |
136 | protected: |
137 | Q3DTheme *q_ptr; |
138 | }; |
139 | |
140 | QT_END_NAMESPACE |
141 | |
142 | #endif |
143 | |