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