1 | // Copyright (C) 2024 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 QGRAPHSTHEME_P_H |
15 | #define QGRAPHSTHEME_P_H |
16 | #include <QtGraphs/qgraphstheme.h> |
17 | #include <QtQuick/private/qquickrectangle_p.h> |
18 | #include <private/qobject_p.h> |
19 | |
20 | QT_BEGIN_NAMESPACE |
21 | |
22 | class QGraphsThemePrivate : public QObjectPrivate |
23 | { |
24 | public: |
25 | QGraphsThemePrivate(); |
26 | ~QGraphsThemePrivate() override; |
27 | |
28 | private: |
29 | struct QGraphsCustomBitField |
30 | { |
31 | bool plotAreaBackgroundColorCustom : 1; |
32 | bool seriesColorsCustom : 1; |
33 | bool borderColorsCustom : 1; |
34 | bool seriesGradientCustom : 1; |
35 | bool labelBackgroundColorCustom : 1; |
36 | bool labelTextColorCustom : 1; |
37 | bool multiHighlightColorCustom : 1; |
38 | bool multiHighlightGradientCustom : 1; |
39 | bool singleHighlightColorCustom : 1; |
40 | bool singleHighlightGradientCustom : 1; |
41 | bool backgroundColorCustom : 1; |
42 | bool axisXLabelFontCustom : 1; |
43 | bool axisYLabelFontCustom : 1; |
44 | bool axisZLabelFontCustom : 1; |
45 | |
46 | QGraphsCustomBitField() |
47 | : plotAreaBackgroundColorCustom(false) |
48 | , seriesColorsCustom(false) |
49 | , borderColorsCustom(false) |
50 | , seriesGradientCustom(false) |
51 | , labelBackgroundColorCustom(false) |
52 | , labelTextColorCustom(false) |
53 | , multiHighlightColorCustom(false) |
54 | , multiHighlightGradientCustom(false) |
55 | , singleHighlightColorCustom(false) |
56 | , singleHighlightGradientCustom(false) |
57 | , backgroundColorCustom(false) |
58 | , axisXLabelFontCustom(false) |
59 | , axisYLabelFontCustom(false) |
60 | , axisZLabelFontCustom(false) |
61 | {} |
62 | }; |
63 | |
64 | QGraphsThemeDirtyBitField m_dirtyBits; |
65 | QGraphsCustomBitField m_customBits; |
66 | |
67 | QMetaObject::Connection m_autoColorConnection; |
68 | bool m_themeDirty = false; |
69 | QGraphsTheme::ColorScheme m_colorScheme = QGraphsTheme::ColorScheme::Automatic; |
70 | QGraphsTheme::Theme m_theme = QGraphsTheme::Theme::QtGreen; |
71 | QGraphsTheme::ColorStyle m_colorStyle = QGraphsTheme::ColorStyle::Uniform; |
72 | QList<QObject *> m_themeChildren; |
73 | QColor m_plotAreaBackgroundColor; |
74 | QColor m_plotAreaBackgroundThemeColor; |
75 | bool m_backgroundVisibility = false; |
76 | bool m_gridVisibility = false; |
77 | QColor m_backgroundColor; |
78 | QColor m_backgroundThemeColor; |
79 | bool m_plotAreaBackgroundVisibility = false; |
80 | bool m_labelsVisibility = false; |
81 | QColor m_labelBackgroundColor; |
82 | QColor m_labelBackgroundThemeColor; |
83 | QColor m_labelTextColor; |
84 | QColor m_labelTextThemeColor; |
85 | bool m_labelBackgroundVisibility = false; |
86 | bool m_labelBorderVisibility = false; |
87 | QColor m_singleHighlightColor; |
88 | QColor m_singleHighlightThemeColor; |
89 | QColor m_multiHighlightColor; |
90 | QColor m_multiHighlightThemeColor; |
91 | QLinearGradient m_multiHighlightGradient; |
92 | QLinearGradient m_multiHighlightThemeGradient; |
93 | QLinearGradient m_singleHighlightGradient; |
94 | QLinearGradient m_singleHighlightThemeGradient; |
95 | QFont m_labelFont; |
96 | QList<QColor> m_seriesColors; |
97 | QList<QColor> m_seriesThemeColors; |
98 | QList<QColor> m_borderColors; |
99 | QList<QColor> m_borderThemeColors; |
100 | qreal m_borderWidth = 1.0; |
101 | QList<QLinearGradient> m_seriesGradients; |
102 | QList<QLinearGradient> m_seriesThemeGradients; |
103 | |
104 | QList<QQuickGraphsColor *> m_colors; |
105 | QList<QQuickGradient *> m_gradients; |
106 | QQuickGradient *m_singleHLQuickGradient = nullptr; |
107 | QQuickGradient *m_multiHLQuickGradient = nullptr; |
108 | |
109 | QFont m_axisXLabelFont; |
110 | QFont m_axisYLabelFont; |
111 | QFont m_axisZLabelFont; |
112 | |
113 | QGraphsLine m_grid; |
114 | QGraphsLine m_axisX; |
115 | QGraphsLine m_axisY; |
116 | QGraphsLine m_axisZ; |
117 | |
118 | bool m_dummyColors = false; |
119 | |
120 | bool m_componentComplete = false; |
121 | |
122 | Q_DECLARE_PUBLIC(QGraphsTheme) |
123 | Q_DISABLE_COPY_MOVE(QGraphsThemePrivate) |
124 | }; |
125 | |
126 | struct QGraphsLinePrivate : public QSharedData |
127 | { |
128 | struct QGraphsLineCustomField |
129 | { |
130 | bool mainColorCustom : 1; |
131 | bool subColorCustom : 1; |
132 | bool labelTextColorCustom : 1; |
133 | |
134 | QGraphsLineCustomField() |
135 | : mainColorCustom(false) |
136 | , subColorCustom(false) |
137 | , labelTextColorCustom(false) |
138 | {} |
139 | }; |
140 | |
141 | QGraphsLinePrivate(); |
142 | ~QGraphsLinePrivate(); |
143 | QGraphsLinePrivate(const QGraphsLinePrivate &other); |
144 | void resetCustomBits(); |
145 | |
146 | QColor m_mainColor; |
147 | QColor m_subColor; |
148 | qreal m_mainWidth; |
149 | qreal m_subWidth; |
150 | QColor m_labelTextColor; |
151 | |
152 | QColor m_mainThemeColor; |
153 | QColor m_subThemeColor; |
154 | QColor m_labelTextThemeColor; |
155 | QGraphsLineCustomField m_bits; |
156 | |
157 | friend bool comparesEqual(const QGraphsLinePrivate &lhs, const QGraphsLinePrivate &rhs) noexcept; |
158 | Q_DECLARE_EQUALITY_COMPARABLE(QGraphsLinePrivate) |
159 | |
160 | friend QGraphsLine; |
161 | }; |
162 | |
163 | QT_END_NAMESPACE |
164 | #endif // QGRAPHSTHEME_P_H |
165 | |