Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickmaterialstyle.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5
6#include <QtCore/qdebug.h>
7#if QT_CONFIG(settings)
8#include <QtCore/qsettings.h>
9#endif
10#include <QtQml/qqmlinfo.h>
11#include <QtQuickControls2/private/qquickstyle_p.h>
12
14
15static const QRgb colors[][14] = {
16 // Red
17 {
18 0xFFFFEBEE, // Shade50
19 0xFFFFCDD2, // Shade100
20 0xFFEF9A9A, // Shade200
21 0xFFE57373, // Shade300
22 0xFFEF5350, // Shade400
23 0xFFF44336, // Shade500
24 0xFFE53935, // Shade600
25 0xFFD32F2F, // Shade700
26 0xFFC62828, // Shade800
27 0xFFB71C1C, // Shade900
28 0xFFFF8A80, // ShadeA100
29 0xFFFF5252, // ShadeA200
30 0xFFFF1744, // ShadeA400
31 0xFFD50000 // ShadeA700
32 },
33 // Pink
34 {
35 0xFFFCE4EC, // Shade50
36 0xFFF8BBD0, // Shade100
37 0xFFF48FB1, // Shade200
38 0xFFF06292, // Shade300
39 0xFFEC407A, // Shade400
40 0xFFE91E63, // Shade500
41 0xFFD81B60, // Shade600
42 0xFFC2185B, // Shade700
43 0xFFAD1457, // Shade800
44 0xFF880E4F, // Shade900
45 0xFFFF80AB, // ShadeA100
46 0xFFFF4081, // ShadeA200
47 0xFFF50057, // ShadeA400
48 0xFFC51162 // ShadeA700
49 },
50 // Purple
51 {
52 0xFFF3E5F5, // Shade50
53 0xFFE1BEE7, // Shade100
54 0xFFCE93D8, // Shade200
55 0xFFBA68C8, // Shade300
56 0xFFAB47BC, // Shade400
57 0xFF9C27B0, // Shade500
58 0xFF8E24AA, // Shade600
59 0xFF7B1FA2, // Shade700
60 0xFF6A1B9A, // Shade800
61 0xFF4A148C, // Shade900
62 0xFFEA80FC, // ShadeA100
63 0xFFE040FB, // ShadeA200
64 0xFFD500F9, // ShadeA400
65 0xFFAA00FF // ShadeA700
66 },
67 // DeepPurple
68 {
69 0xFFEDE7F6, // Shade50
70 0xFFD1C4E9, // Shade100
71 0xFFB39DDB, // Shade200
72 0xFF9575CD, // Shade300
73 0xFF7E57C2, // Shade400
74 0xFF673AB7, // Shade500
75 0xFF5E35B1, // Shade600
76 0xFF512DA8, // Shade700
77 0xFF4527A0, // Shade800
78 0xFF311B92, // Shade900
79 0xFFB388FF, // ShadeA100
80 0xFF7C4DFF, // ShadeA200
81 0xFF651FFF, // ShadeA400
82 0xFF6200EA // ShadeA700
83 },
84 // Indigo
85 {
86 0xFFE8EAF6, // Shade50
87 0xFFC5CAE9, // Shade100
88 0xFF9FA8DA, // Shade200
89 0xFF7986CB, // Shade300
90 0xFF5C6BC0, // Shade400
91 0xFF3F51B5, // Shade500
92 0xFF3949AB, // Shade600
93 0xFF303F9F, // Shade700
94 0xFF283593, // Shade800
95 0xFF1A237E, // Shade900
96 0xFF8C9EFF, // ShadeA100
97 0xFF536DFE, // ShadeA200
98 0xFF3D5AFE, // ShadeA400
99 0xFF304FFE // ShadeA700
100 },
101 // Blue
102 {
103 0xFFE3F2FD, // Shade50
104 0xFFBBDEFB, // Shade100
105 0xFF90CAF9, // Shade200
106 0xFF64B5F6, // Shade300
107 0xFF42A5F5, // Shade400
108 0xFF2196F3, // Shade500
109 0xFF1E88E5, // Shade600
110 0xFF1976D2, // Shade700
111 0xFF1565C0, // Shade800
112 0xFF0D47A1, // Shade900
113 0xFF82B1FF, // ShadeA100
114 0xFF448AFF, // ShadeA200
115 0xFF2979FF, // ShadeA400
116 0xFF2962FF // ShadeA700
117 },
118 // LightBlue
119 {
120 0xFFE1F5FE, // Shade50
121 0xFFB3E5FC, // Shade100
122 0xFF81D4FA, // Shade200
123 0xFF4FC3F7, // Shade300
124 0xFF29B6F6, // Shade400
125 0xFF03A9F4, // Shade500
126 0xFF039BE5, // Shade600
127 0xFF0288D1, // Shade700
128 0xFF0277BD, // Shade800
129 0xFF01579B, // Shade900
130 0xFF80D8FF, // ShadeA100
131 0xFF40C4FF, // ShadeA200
132 0xFF00B0FF, // ShadeA400
133 0xFF0091EA // ShadeA700
134 },
135 // Cyan
136 {
137 0xFFE0F7FA, // Shade50
138 0xFFB2EBF2, // Shade100
139 0xFF80DEEA, // Shade200
140 0xFF4DD0E1, // Shade300
141 0xFF26C6DA, // Shade400
142 0xFF00BCD4, // Shade500
143 0xFF00ACC1, // Shade600
144 0xFF0097A7, // Shade700
145 0xFF00838F, // Shade800
146 0xFF006064, // Shade900
147 0xFF84FFFF, // ShadeA100
148 0xFF18FFFF, // ShadeA200
149 0xFF00E5FF, // ShadeA400
150 0xFF00B8D4 // ShadeA700
151 },
152 // Teal
153 {
154 0xFFE0F2F1, // Shade50
155 0xFFB2DFDB, // Shade100
156 0xFF80CBC4, // Shade200
157 0xFF4DB6AC, // Shade300
158 0xFF26A69A, // Shade400
159 0xFF009688, // Shade500
160 0xFF00897B, // Shade600
161 0xFF00796B, // Shade700
162 0xFF00695C, // Shade800
163 0xFF004D40, // Shade900
164 0xFFA7FFEB, // ShadeA100
165 0xFF64FFDA, // ShadeA200
166 0xFF1DE9B6, // ShadeA400
167 0xFF00BFA5 // ShadeA700
168 },
169 // Green
170 {
171 0xFFE8F5E9, // Shade50
172 0xFFC8E6C9, // Shade100
173 0xFFA5D6A7, // Shade200
174 0xFF81C784, // Shade300
175 0xFF66BB6A, // Shade400
176 0xFF4CAF50, // Shade500
177 0xFF43A047, // Shade600
178 0xFF388E3C, // Shade700
179 0xFF2E7D32, // Shade800
180 0xFF1B5E20, // Shade900
181 0xFFB9F6CA, // ShadeA100
182 0xFF69F0AE, // ShadeA200
183 0xFF00E676, // ShadeA400
184 0xFF00C853 // ShadeA700
185 },
186 // LightGreen
187 {
188 0xFFF1F8E9, // Shade50
189 0xFFDCEDC8, // Shade100
190 0xFFC5E1A5, // Shade200
191 0xFFAED581, // Shade300
192 0xFF9CCC65, // Shade400
193 0xFF8BC34A, // Shade500
194 0xFF7CB342, // Shade600
195 0xFF689F38, // Shade700
196 0xFF558B2F, // Shade800
197 0xFF33691E, // Shade900
198 0xFFCCFF90, // ShadeA100
199 0xFFB2FF59, // ShadeA200
200 0xFF76FF03, // ShadeA400
201 0xFF64DD17 // ShadeA700
202 },
203 // Lime
204 {
205 0xFFF9FBE7, // Shade50
206 0xFFF0F4C3, // Shade100
207 0xFFE6EE9C, // Shade200
208 0xFFDCE775, // Shade300
209 0xFFD4E157, // Shade400
210 0xFFCDDC39, // Shade500
211 0xFFC0CA33, // Shade600
212 0xFFAFB42B, // Shade700
213 0xFF9E9D24, // Shade800
214 0xFF827717, // Shade900
215 0xFFF4FF81, // ShadeA100
216 0xFFEEFF41, // ShadeA200
217 0xFFC6FF00, // ShadeA400
218 0xFFAEEA00 // ShadeA700
219 },
220 // Yellow
221 {
222 0xFFFFFDE7, // Shade50
223 0xFFFFF9C4, // Shade100
224 0xFFFFF59D, // Shade200
225 0xFFFFF176, // Shade300
226 0xFFFFEE58, // Shade400
227 0xFFFFEB3B, // Shade500
228 0xFFFDD835, // Shade600
229 0xFFFBC02D, // Shade700
230 0xFFF9A825, // Shade800
231 0xFFF57F17, // Shade900
232 0xFFFFFF8D, // ShadeA100
233 0xFFFFFF00, // ShadeA200
234 0xFFFFEA00, // ShadeA400
235 0xFFFFD600 // ShadeA700
236 },
237 // Amber
238 {
239 0xFFFFF8E1, // Shade50
240 0xFFFFECB3, // Shade100
241 0xFFFFE082, // Shade200
242 0xFFFFD54F, // Shade300
243 0xFFFFCA28, // Shade400
244 0xFFFFC107, // Shade500
245 0xFFFFB300, // Shade600
246 0xFFFFA000, // Shade700
247 0xFFFF8F00, // Shade800
248 0xFFFF6F00, // Shade900
249 0xFFFFE57F, // ShadeA100
250 0xFFFFD740, // ShadeA200
251 0xFFFFC400, // ShadeA400
252 0xFFFFAB00 // ShadeA700
253 },
254 // Orange
255 {
256 0xFFFFF3E0, // Shade50
257 0xFFFFE0B2, // Shade100
258 0xFFFFCC80, // Shade200
259 0xFFFFB74D, // Shade300
260 0xFFFFA726, // Shade400
261 0xFFFF9800, // Shade500
262 0xFFFB8C00, // Shade600
263 0xFFF57C00, // Shade700
264 0xFFEF6C00, // Shade800
265 0xFFE65100, // Shade900
266 0xFFFFD180, // ShadeA100
267 0xFFFFAB40, // ShadeA200
268 0xFFFF9100, // ShadeA400
269 0xFFFF6D00 // ShadeA700
270 },
271 // DeepOrange
272 {
273 0xFFFBE9E7, // Shade50
274 0xFFFFCCBC, // Shade100
275 0xFFFFAB91, // Shade200
276 0xFFFF8A65, // Shade300
277 0xFFFF7043, // Shade400
278 0xFFFF5722, // Shade500
279 0xFFF4511E, // Shade600
280 0xFFE64A19, // Shade700
281 0xFFD84315, // Shade800
282 0xFFBF360C, // Shade900
283 0xFFFF9E80, // ShadeA100
284 0xFFFF6E40, // ShadeA200
285 0xFFFF3D00, // ShadeA400
286 0xFFDD2C00 // ShadeA700
287 },
288 // Brown
289 {
290 0xFFEFEBE9, // Shade50
291 0xFFD7CCC8, // Shade100
292 0xFFBCAAA4, // Shade200
293 0xFFA1887F, // Shade300
294 0xFF8D6E63, // Shade400
295 0xFF795548, // Shade500
296 0xFF6D4C41, // Shade600
297 0xFF5D4037, // Shade700
298 0xFF4E342E, // Shade800
299 0xFF3E2723, // Shade900
300 0xFF000000, // ShadeA100
301 0xFF000000, // ShadeA200
302 0xFF000000, // ShadeA400
303 0xFF000000 // ShadeA700
304 },
305 // Grey
306 {
307 0xFFFAFAFA, // Shade50
308 0xFFF5F5F5, // Shade100
309 0xFFEEEEEE, // Shade200
310 0xFFE0E0E0, // Shade300
311 0xFFBDBDBD, // Shade400
312 0xFF9E9E9E, // Shade500
313 0xFF757575, // Shade600
314 0xFF616161, // Shade700
315 0xFF424242, // Shade800
316 0xFF212121, // Shade900
317 0xFF000000, // ShadeA100
318 0xFF000000, // ShadeA200
319 0xFF000000, // ShadeA400
320 0xFF000000 // ShadeA700
321 },
322 // BlueGrey
323 {
324 0xFFECEFF1, // Shade50
325 0xFFCFD8DC, // Shade100
326 0xFFB0BEC5, // Shade200
327 0xFF90A4AE, // Shade300
328 0xFF78909C, // Shade400
329 0xFF607D8B, // Shade500
330 0xFF546E7A, // Shade600
331 0xFF455A64, // Shade700
332 0xFF37474F, // Shade800
333 0xFF263238, // Shade900
334 0xFF000000, // ShadeA100
335 0xFF000000, // ShadeA200
336 0xFF000000, // ShadeA400
337 0xFF000000 // ShadeA700
338 }
339};
340
341// If no value was inherited from a parent or explicitly set, the "global" values are used.
342// The initial, default values of the globals are hard-coded here, but the environment
343// variables and .conf file override them if specified.
347static uint globalForeground = 0xDD000000; // primaryTextColorLight
348static uint globalBackground = 0xFFFAFAFA; // backgroundColorLight
349// These represent whether a global foreground/background was set.
350// Each style's m_hasForeground/m_hasBackground are initialized to these values.
351static bool hasGlobalForeground = false;
352static bool hasGlobalBackground = false;
353// These represent whether or not the global color value was specified as one of the
354// values that QColor accepts, as opposed to one of the pre-defined colors like Red.
355static bool globalPrimaryCustom = false;
356static bool globalAccentCustom = false;
357static bool globalForegroundCustom = true;
358static bool globalBackgroundCustom = true;
359// This is global because:
360// 1) The theme needs access to it to determine font sizes.
361// 2) There can only be one variant used for the whole application.
363static const QRgb backgroundColorLight = 0xFFFFFBFE;
364static const QRgb backgroundColorDark = 0xFF1C1B1F;
365static const QRgb dialogColorLight = 0xFFFFFFFF;
366static const QRgb dialogColorDark = 0xFF424242;
367static const QRgb primaryTextColorLight = 0xDD000000;
368static const QRgb primaryTextColorDark = 0xFFFFFFFF;
369static const QRgb secondaryTextColorLight = 0x89000000;
370static const QRgb secondaryTextColorDark = 0xB2FFFFFF;
371static const QRgb hintTextColorLight = 0x60000000;
372static const QRgb hintTextColorDark = 0x4CFFFFFF;
373static const QRgb dividerColorLight = 0x1E000000;
374static const QRgb dividerColorDark = 0x1EFFFFFF;
375static const QRgb iconColorLight = 0x89000000;
376static const QRgb iconColorDark = 0xFFFFFFFF;
377static const QRgb iconDisabledColorLight = 0x42000000;
378static const QRgb iconDisabledColorDark = 0x4CFFFFFF;
379static const QRgb raisedButtonColorLight = 0xFFD6D7D7;
380static const QRgb raisedButtonColorDark = 0x3FCCCCCC;
385static const QRgb rippleColorLight = 0x10000000;
386static const QRgb rippleColorDark = 0x20FFFFFF;
387static const QRgb spinBoxDisabledIconColorLight = 0xFFCCCCCC;
388static const QRgb spinBoxDisabledIconColorDark = 0xFF666666;
389static const QRgb sliderDisabledColorLight = 0xFF9E9E9E;
390static const QRgb sliderDisabledColorDark = 0xFF616161;
391/*
392 https://m3.material.io/components/switch/specs#57a434cd-5fcc-4d79-9bff-12b2a9768789
393
394 light / dark
395 surface: #FFFBFE/#1C1B1F
396 on-surface: #1C1B1F/#E6E1E5
397 surface-variant: #E7E0EC/#49454F
398
399 12% = 1E
400 38% = 61
401
402 handle
403
404 unchecked checked
405 disabled #1C1B1F/#E6E1E5 @ 38% (#611C1B1F/#61E6E1E5) #FFFBFE/#1C1B1F @ 100%
406
407 track
408
409 unchecked checked
410 disabled #E7E0EC/#49454F @ 12% (#1EE7E0EC/#1E49454F) #1C1B1F/#E6E1E5 @ 12% (#1E1C1B1F/#1EE6E1E5)
411
412 track outline
413
414 unchecked checked
415 disabled #1C1B1F/#E6E1E5 @ 12% (#1E1C1B1F/#1EE6E1E5) same as track
416*/
417static const QRgb switchUncheckedTrackColorLight = 0xFFE7E0EC;
418static const QRgb switchUncheckedTrackColorDark = 0x49454F;
427static const QRgb textFieldFilledContainerColorLight = 0xFFE7E0EC;
428static const QRgb textFieldFilledContainerColorDark = 0xFF49454F;
429
436
438 m_customPrimary(globalPrimaryCustom),
439 m_customAccent(globalAccentCustom),
440 m_customForeground(globalForegroundCustom),
441 m_customBackground(globalBackgroundCustom),
442 m_hasForeground(hasGlobalForeground),
443 m_hasBackground(hasGlobalBackground),
444 m_theme(globalTheme),
445 m_primary(globalPrimary),
446 m_accent(globalAccent),
447 m_foreground(globalForeground),
448 m_background(globalBackground)
449{
451}
452
457
459{
460 return m_theme;
461}
462
464{
465 if (theme == System)
467
468 m_explicitTheme = true;
469 if (m_theme == theme)
470 return;
471
472 m_theme = theme;
474 themeChange();
475 if (!m_customAccent)
476 accentChange();
477 if (!m_hasBackground)
479 if (!m_hasForeground)
481}
482
484{
485 if (m_explicitTheme || m_theme == theme)
486 return;
487
488 m_theme = theme;
490 themeChange();
491 if (!m_customAccent)
492 accentChange();
493 if (!m_hasBackground)
495 if (!m_hasForeground)
497}
498
500{
501 const auto styles = attachedChildren();
503 QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child);
504 if (material)
505 material->inheritTheme(m_theme);
506 }
507}
508
510{
511 if (!m_explicitTheme)
512 return;
513
514 m_explicitTheme = false;
515 QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(attachedParent());
516 inheritTheme(material ? material->theme() : globalTheme);
517}
518
529
531{
532 return primaryColor();
533}
534
536{
537 QRgb primary = 0;
538 bool custom = false;
539 if (!variantToRgba(var, "primary", &primary, &custom))
540 return;
541
542 m_explicitPrimary = true;
543 if (m_primary == primary)
544 return;
545
546 m_customPrimary = custom;
547 m_primary = primary;
550}
551
553{
554 if (m_explicitPrimary || m_primary == primary)
555 return;
556
557 m_customPrimary = custom;
558 m_primary = primary;
561}
562
564{
565 const auto styles = attachedChildren();
567 QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child);
568 if (material)
569 material->inheritPrimary(m_primary, m_customPrimary);
570 }
571}
572
574{
575 if (!m_explicitPrimary)
576 return;
577
578 m_customPrimary = false;
579 m_explicitPrimary = false;
580 QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(attachedParent());
581 if (material)
582 inheritPrimary(material->m_primary, material->m_customPrimary);
583 else
585}
586
593
595{
596 return accentColor();
597}
598
600{
601 QRgb accent = 0;
602 bool custom = false;
603 if (!variantToRgba(var, "accent", &accent, &custom))
604 return;
605
606 m_explicitAccent = true;
607 if (m_accent == accent)
608 return;
609
610 m_customAccent = custom;
611 m_accent = accent;
613 accentChange();
614}
615
617{
618 if (m_explicitAccent || m_accent == accent)
619 return;
620
621 m_customAccent = custom;
622 m_accent = accent;
624 accentChange();
625}
626
628{
629 const auto styles = attachedChildren();
631 QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child);
632 if (material)
633 material->inheritAccent(m_accent, m_customAccent);
634 }
635}
636
638{
639 if (!m_explicitAccent)
640 return;
641
642 m_customAccent = false;
643 m_explicitAccent = false;
644 QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(attachedParent());
645 if (material)
646 inheritAccent(material->m_accent, material->m_customAccent);
647 else
649}
650
656
658{
659 if (!m_hasForeground)
661 if (m_customForeground)
662 return QColor::fromRgba(m_foreground);
663 if (m_foreground > BlueGrey)
664 return QColor();
665 return QColor::fromRgba(colors[m_foreground][Shade500]);
666}
667
669{
670 QRgb foreground = 0;
671 bool custom = false;
672 if (!variantToRgba(var, "foreground", &foreground, &custom))
673 return;
674
675 m_hasForeground = true;
676 m_explicitForeground = true;
677 if (m_foreground == foreground)
678 return;
679
680 m_customForeground = custom;
681 m_foreground = foreground;
684}
685
686void QQuickMaterialStyle::inheritForeground(uint foreground, bool custom, bool has)
687{
688 if (m_explicitForeground || m_foreground == foreground)
689 return;
690
691 m_hasForeground = has;
692 m_customForeground = custom;
693 m_foreground = foreground;
696}
697
699{
700 const auto styles = attachedChildren();
702 QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child);
703 if (material)
704 material->inheritForeground(m_foreground, m_customForeground, m_hasForeground);
705 }
706}
707
709{
710 if (!m_explicitForeground)
711 return;
712
713 m_hasForeground = false;
714 m_customForeground = false;
715 m_explicitForeground = false;
716 QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(attachedParent());
717 inheritForeground(material ? material->m_foreground : globalForeground, true, material ? material->m_hasForeground : false);
718}
719
721{
724 // TODO: This causes a binding loop: see QTBUG-85699 and the comments on its fix
725// emit toolTextColorChanged();
726}
727
732
734{
735 QRgb background = 0;
736 bool custom = false;
737 if (!variantToRgba(var, "background", &background, &custom))
738 return;
739
740 m_hasBackground = true;
741 m_explicitBackground = true;
742 if (m_background == background)
743 return;
744
745 m_customBackground = custom;
746 m_background = background;
749}
750
751void QQuickMaterialStyle::inheritBackground(uint background, bool custom, bool has)
752{
753 if (m_explicitBackground || m_background == background)
754 return;
755
756 m_hasBackground = has;
757 m_customBackground = custom;
758 m_background = background;
761}
762
764{
765 const auto styles = attachedChildren();
767 QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child);
768 if (material)
769 material->inheritBackground(m_background, m_customBackground, m_hasBackground);
770 }
771}
772
774{
775 if (!m_explicitBackground)
776 return;
777
778 m_hasBackground = false;
779 m_customBackground = false;
780 m_explicitBackground = false;
781 QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(attachedParent());
782 inheritBackground(material ? material->m_background : globalBackground, true, material ? material->m_hasBackground : false);
783}
784
792
794{
795 return m_elevation;
796}
797
799{
800 if (m_elevation == elevation)
801 return;
802
803 m_elevation = elevation;
805}
806
811
816
818{
819 return m_roundedScale;
820}
821
823{
824 if (m_roundedScale == roundedScale)
825 return;
826
827 m_roundedScale = roundedScale;
829}
830
835
840
842{
843 if (m_containerStyle == containerStyle)
844 return;
845
846 m_containerStyle = containerStyle;
848}
849
854
856{
857 if (m_customPrimary)
858 return QColor::fromRgba(m_primary);
859 if (m_primary > BlueGrey)
860 return QColor();
861 return colors[m_primary][Shade500];
862}
863
865{
866 if (m_customAccent)
867 return shade == themeShade() ? QColor::fromRgba(m_accent)
868 : this->shade(QColor::fromRgba(m_accent), shade);
869 if (m_accent > BlueGrey)
870 return QColor();
871 return colors[m_accent][shade];
872}
873
875{
876 return accentColor(themeShade());
877}
878
880{
881 if (!m_hasBackground)
883 if (m_customBackground)
884 return shade == themeShade() ? QColor::fromRgba(m_background)
885 : this->shade(QColor::fromRgba(m_background), shade);
886 if (m_background > BlueGrey)
887 return QColor();
888 return colors[m_background][shade];
889}
890
892{
893 return backgroundColor(themeShade());
894}
895
900
902{
903 if (m_explicitForeground)
904 return primaryTextColor();
906}
907
912
917
919{
921 color.setAlphaF(0.4f);
922 return color;
923}
924
926{
927 return QColor::fromRgba(0x40000000);
928}
929
934
939
944
945QColor QQuickMaterialStyle::buttonColor(Theme theme, const QVariant &background, const QVariant &accent,
946 bool enabled, bool flat, bool highlighted, bool checked) const
947{
948 if (!enabled && !flat) {
949 return QColor::fromRgba(m_theme == Light
951 }
952
953 // We don't use theme (and other arguments) here even though we pass it in, as it's
954 // simpler to just re-use themeShade. We still need the arguments because they allow
955 // us to be re-called whenever they change.
956 Shade shade = themeShade();
960
962
963 if (m_explicitBackground) {
965 } else if (highlighted) {
966 if (m_theme == Light) {
968 if (checked)
969 color = color.lighter();
970 } else {
971 // A highlighted + checked button should become darker.
972 color = accentColor(checked ? Shade100 : shade);
973 }
974 // Flat, highlighted buttons need to have a semi-transparent background,
975 // otherwise the text won't be visible.
976 if (flat)
977 color.setAlphaF(0.25);
978 } else if (!flat) {
979 // Even if the elevation is zero, it should still have a background if it's not flat.
982 }
983
984 return color;
985}
986
991
996
998{
999 QColor pressColor = accentColor();
1000 pressColor.setAlpha(m_theme == Light ? 30 : 50);
1001 return pressColor;
1002}
1003
1008
1010{
1011 return accentColor(m_theme == Light ? themeShade() : Shade100);
1012}
1013
1019
1025
1031
1036
1038{
1040 return m_theme == Light ? color.darker(140) : color.lighter(120);
1041}
1042
1044{
1045 return m_theme == Light ? QColor::fromRgb(0xFFFFFF) : accentColor(Shade800);
1046}
1047
1049{
1050 if (m_theme == Light)
1051 return QColor::fromRgba(0x611C1B1F);
1052
1053 QColor darkHandleColor = color(Grey, Shade800);
1054 darkHandleColor.setAlphaF(0.38f);
1055 return darkHandleColor;
1056}
1057
1059{
1060 return QColor::fromRgb(m_theme == Light ? 0xFFFBFE : 0x1C1B1F);
1061}
1062
1064{
1065 return QColor::fromRgba(m_theme == Light ? 0x611C1B1F : 0x61E6E1E5);
1066}
1067
1073
1075{
1076 return QColor::fromRgba(m_theme == Light ? 0x40000000 : 0x40FFFFFF);
1077}
1078
1080{
1081 return QColor::fromRgba(m_theme == Light ? 0x60000000 : 0x60FFFFFF);
1082}
1083
1085{
1086 return QColor::fromRgba(m_theme == Light ? 0x80000000 : 0x80FFFFFF);
1087}
1088
1090{
1091 if (m_hasBackground)
1092 return backgroundColor();
1094}
1095
1097{
1098 return QColor::fromRgba(m_theme == Light ? 0x99303030 : 0x99fafafa);
1099}
1100
1102{
1103 return QColor::fromRgba(m_theme == Light ? 0x1e000000 : 0x1effffff);
1104}
1105
1107{
1108 if (m_explicitBackground)
1109 return backgroundColor();
1110 return color(Grey, Shade700);
1111}
1112
1114{
1115 if (m_explicitBackground)
1116 return backgroundColor();
1117 return primaryColor();
1118}
1119
1121{
1122 if (m_hasForeground || m_customPrimary)
1123 return primaryTextColor();
1124
1125 switch (m_primary) {
1126 case Red:
1127 case Pink:
1128 case Purple:
1129 case DeepPurple:
1130 case Indigo:
1131 case Blue:
1132 case Teal:
1133 case DeepOrange:
1134 case Brown:
1135 case BlueGrey:
1137
1138 case LightBlue:
1139 case Cyan:
1140 case Green:
1141 case LightGreen:
1142 case Lime:
1143 case Yellow:
1144 case Amber:
1145 case Orange:
1146 case Grey:
1148
1149 default:
1150 break;
1151 }
1152
1153 return primaryTextColor();
1154}
1155
1160
1165
1170
1172{
1173 int count = sizeof(colors) / sizeof(colors[0]);
1174 if (color < 0 || color >= count)
1175 return QColor();
1176
1177 count = sizeof(colors[0]) / sizeof(colors[0][0]);
1178 if (shade < 0 || shade >= count)
1179 return QColor();
1180
1181 return colors[color][shade];
1182}
1183
1184static QColor lighterShade(const QColor &color, qreal amount)
1185{
1186 QColor hsl = color.toHsl();
1187 hsl.setHslF(hsl.hueF(), hsl.saturationF(), qBound<qreal>(0.0, hsl.lightnessF() + amount, 1.0), color.alphaF());
1188 return hsl.convertTo(color.spec());
1189}
1190
1191static QColor darkerShade(const QColor &color, qreal amount)
1192{
1193 QColor hsl = color.toHsl();
1194 hsl.setHslF(hsl.hueF(), hsl.saturationF(), qBound<qreal>(0.0, hsl.lightnessF() - amount, 1.0), color.alphaF());
1195 return hsl.convertTo(color.spec());
1196}
1197
1198QQuickMaterialStyle::Shade QQuickMaterialStyle::themeShade() const
1199{
1200 return m_theme == Light ? Shade500 : Shade200;
1201}
1202
1203/*
1204 * The following lightness values originate from the Material Design Color Generator project.
1205 *
1206 * The MIT License (MIT)
1207 *
1208 * Copyright (c) 2015 mbitson
1209 *
1210 * Permission is hereby granted, free of charge, to any person obtaining a copy
1211 * of this software and associated documentation files (the "Software"), to deal
1212 * in the Software without restriction, including without limitation the rights
1213 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1214 * copies of the Software, and to permit persons to whom the Software is
1215 * furnished to do so, subject to the following conditions:
1216 *
1217 * The above copyright notice and this permission notice shall be included in all
1218 * copies or substantial portions of the Software.
1219 *
1220 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1221 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1222 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1223 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1224 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1225 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1226 * SOFTWARE.
1227 */
1228
1229// Returns the same color, if shade == themeShade()
1231{
1232 switch (shade) {
1233 case Shade50:
1234 return lighterShade(color, m_theme == Light ? 0.52 : 0.26);
1235 case Shade100:
1236 return lighterShade(color, m_theme == Light ? 0.37 : 0.11);
1237 case Shade200:
1238 return m_theme == Light ? lighterShade(color, 0.26) : color;
1239 case Shade300:
1240 return m_theme == Light ? lighterShade(color, 0.12) : darkerShade(color, 0.14);
1241 case Shade400:
1242 return m_theme == Light ? lighterShade(color, 0.06) : darkerShade(color, 0.20);
1243 case Shade500:
1244 return m_theme == Light ? color : darkerShade(color, 0.26);
1245 case Shade600:
1246 return darkerShade(color, m_theme == Light ? 0.06 : 0.32);
1247 case Shade700:
1248 return darkerShade(color, m_theme == Light ? 0.12 : 0.38);
1249 case Shade800:
1250 return darkerShade(color, m_theme == Light ? 0.18 : 0.44);
1251 case Shade900:
1252 return darkerShade(color, m_theme == Light ? 0.24 : 0.50);
1253 case ShadeA100:
1254 return lighterShade(color, m_theme == Light ? 0.54 : 0.28);
1255 case ShadeA200:
1256 return lighterShade(color, m_theme == Light ? 0.37 : 0.11);
1257 case ShadeA400:
1258 return m_theme == Light ? lighterShade(color, 0.06) : darkerShade(color, 0.20);
1259 case ShadeA700:
1260 return darkerShade(color, m_theme == Light ? 0.12 : 0.38);
1261 default:
1262 Q_UNREACHABLE_RETURN(QColor());
1263 }
1264}
1265
1267{
1268 // https://material.io/guidelines/components/buttons.html#buttons-style
1269 return globalVariant == Dense ? 44 : 48;
1270}
1271
1273{
1274 return globalVariant == Dense ? 10 : 14;
1275}
1276
1277// https://m3.material.io/components/buttons/specs#256326ad-f934-40e7-b05f-0bcb41aa4382
1278int QQuickMaterialStyle::buttonLeftPadding(bool flat, bool hasIcon) const
1279{
1280 static const int noIconPadding = globalVariant == Dense ? 12 : 24;
1281 static const int iconPadding = globalVariant == Dense ? 8 : 16;
1282 static const int flatPadding = globalVariant == Dense ? 6 : 12;
1283 return !flat ? (!hasIcon ? noIconPadding : iconPadding) : flatPadding;
1284}
1285
1286int QQuickMaterialStyle::buttonRightPadding(bool flat, bool hasIcon, bool hasText) const
1287{
1288 static const int noTextPadding = globalVariant == Dense ? 8 : 16;
1289 static const int textPadding = globalVariant == Dense ? 12 : 24;
1290 static const int flatNoIconPadding = globalVariant == Dense ? 6 : 12;
1291 static const int flatNoTextPadding = globalVariant == Dense ? 6 : 12;
1292 static const int flatTextPadding = globalVariant == Dense ? 8 : 16;
1293 return !flat
1294 ? (!hasText ? noTextPadding : textPadding)
1295 : (!hasIcon ? flatNoIconPadding : (!hasText ? flatNoTextPadding : flatTextPadding));
1296}
1297
1299{
1300 // https://m3.material.io/components/buttons/specs#256326ad-f934-40e7-b05f-0bcb41aa4382
1301 return globalVariant == Dense ? 32 : 40;
1302}
1303
1305{
1306 // https://material.io/guidelines/components/lists.html#lists-specs
1307 return globalVariant == Dense ? 40 : 48;
1308}
1309
1311{
1312 return globalVariant == Dense ? 48 : 52;
1313}
1314
1316{
1317 return globalVariant == Dense ? 16 : 24;
1318}
1319
1320// https://m3.material.io/components/dialogs/specs#6771d107-624e-47cc-b6d8-2b7b620ba2f1
1327
1329{
1330 return globalVariant == Dense ? 8 : 12;
1331}
1332
1334{
1335 // https://material.io/guidelines/components/menus.html#menus-simple-menus
1336 return globalVariant == Dense ? 32 : 48;
1337}
1338
1340{
1341 return globalVariant == Dense ? 8 : 12;
1342}
1343
1345{
1346 return globalVariant == Dense ? 40 : 52;
1347}
1348
1350{
1351 return globalVariant == Dense ? 22 : 32;
1352}
1353
1355{
1356 return globalVariant == Dense ? 10 : 16;
1357}
1358
1360{
1361 return globalVariant == Dense ? 16 : 24;
1362}
1363
1365{
1366 return globalVariant == Dense ? 18 : 28;
1367}
1368
1370{
1371 // SwitchDelegate's indicator is much larger than the others due to the shadow,
1372 // so we must reduce its padding to ensure its implicitHeight is 40 when dense.
1373 return globalVariant == Dense ? 4 : 8;
1374}
1375
1377{
1378 // filled: https://m3.material.io/components/text-fields/specs#8c032848-e442-46df-b25d-28f1315f234b
1379 // outlined: https://m3.material.io/components/text-fields/specs#605e24f1-1c1f-4c00-b385-4bf50733a5ef
1380 return globalVariant == Dense ? 44 : 56;
1381}
1383{
1384 return globalVariant == Dense ? 12 : 16;
1385}
1387{
1388 return globalVariant == Dense ? 4 : 8;
1389}
1390
1392{
1393 // https://material.io/guidelines/components/tooltips.html
1394 return globalVariant == Dense ? 22 : 32;
1395}
1396
1401
1402template <typename Enum>
1403static Enum toEnumValue(const QByteArray &value, bool *ok)
1404{
1405 QMetaEnum enumeration = QMetaEnum::fromType<Enum>();
1406 return static_cast<Enum>(enumeration.keyToValue(value, ok));
1407}
1408
1409static QByteArray resolveSetting(const QByteArray &env, const QSharedPointer<QSettings> &settings, const QString &name)
1410{
1411 QByteArray value = qgetenv(env);
1412#if QT_CONFIG(settings)
1413 if (value.isNull() && !settings.isNull())
1415#endif
1416 return value;
1417}
1418
1420{
1421 QSharedPointer<QSettings> settings = QQuickStylePrivate::settings(QStringLiteral("Material"));
1422
1423 bool ok = false;
1424 QByteArray themeValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_THEME", settings, QStringLiteral("Theme"));
1425 Theme themeEnum = toEnumValue<Theme>(themeValue, &ok);
1426 if (ok)
1427 globalTheme = effectiveTheme(themeEnum);
1428 else if (!themeValue.isEmpty())
1429 qWarning().nospace().noquote() << "Material: unknown theme value: " << themeValue;
1430
1431 QByteArray variantValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_VARIANT", settings, QStringLiteral("Variant"));
1432 Variant variantEnum = toEnumValue<Variant>(variantValue, &ok);
1433 if (ok)
1434 globalVariant = variantEnum;
1435 else if (!variantValue.isEmpty())
1436 qWarning().nospace().noquote() << "Material: unknown variant value: " << variantValue;
1437
1438 QByteArray primaryValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_PRIMARY", settings, QStringLiteral("Primary"));
1439 Color primaryEnum = toEnumValue<Color>(primaryValue, &ok);
1440 if (ok) {
1441 globalPrimaryCustom = false;
1442 globalPrimary = primaryEnum;
1443 } else {
1444 QColor color = QColor::fromString(primaryValue);
1445 if (color.isValid()) {
1446 globalPrimaryCustom = true;
1447 globalPrimary = color.rgba();
1448 } else if (!primaryValue.isEmpty()) {
1449 qWarning().nospace().noquote() << "Material: unknown primary value: " << primaryValue;
1450 }
1451 }
1452
1453 QByteArray accentValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_ACCENT", settings, QStringLiteral("Accent"));
1454 Color accentEnum = toEnumValue<Color>(accentValue, &ok);
1455 if (ok) {
1456 globalAccentCustom = false;
1457 globalAccent = accentEnum;
1458 } else if (!accentValue.isEmpty()) {
1459 QColor color = QColor::fromString(accentValue);
1460 if (color.isValid()) {
1461 globalAccentCustom = true;
1462 globalAccent = color.rgba();
1463 } else {
1464 qWarning().nospace().noquote() << "Material: unknown accent value: " << accentValue;
1465 }
1466 }
1467
1468 QByteArray foregroundValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_FOREGROUND", settings, QStringLiteral("Foreground"));
1469 Color foregroundEnum = toEnumValue<Color>(foregroundValue, &ok);
1470 if (ok) {
1471 globalForegroundCustom = false;
1472 globalForeground = foregroundEnum;
1473 hasGlobalForeground = true;
1474 } else if (!foregroundValue.isEmpty()) {
1475 QColor color = QColor::fromString(foregroundValue);
1476 if (color.isValid()) {
1478 globalForeground = color.rgba();
1479 hasGlobalForeground = true;
1480 } else {
1481 qWarning().nospace().noquote() << "Material: unknown foreground value: " << foregroundValue;
1482 }
1483 }
1484
1485 QByteArray backgroundValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_BACKGROUND", settings, QStringLiteral("Background"));
1486 Color backgroundEnum = toEnumValue<Color>(backgroundValue, &ok);
1487 if (ok) {
1488 globalBackgroundCustom = false;
1489 globalBackground = backgroundEnum;
1490 hasGlobalBackground = true;
1491 } else if (!backgroundValue.isEmpty()) {
1492 QColor color = QColor::fromString(backgroundValue);
1493 if (color.isValid()) {
1495 globalBackground = color.rgba();
1496 hasGlobalBackground = true;
1497 } else {
1498 qWarning().nospace().noquote() << "Material: unknown background value: " << backgroundValue;
1499 }
1500 }
1501}
1502
1504{
1505 Q_UNUSED(oldParent);
1506 QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(newParent);
1507 if (material) {
1508 inheritPrimary(material->m_primary, material->m_customPrimary);
1509 inheritAccent(material->m_accent, material->m_customAccent);
1510 inheritForeground(material->m_foreground, material->m_customForeground, material->m_hasForeground);
1511 inheritBackground(material->m_background, material->m_customBackground, material->m_hasBackground);
1512 inheritTheme(material->theme());
1513 }
1514}
1515
1516bool QQuickMaterialStyle::variantToRgba(const QVariant &var, const char *name, QRgb *rgba, bool *custom) const
1517{
1518 *custom = false;
1519 if (var.metaType().id() == QMetaType::Int) {
1520 int val = var.toInt();
1521 if (val > BlueGrey) {
1522 qmlWarning(parent()) << "unknown Material." << name << " value: " << val;
1523 return false;
1524 }
1525 *rgba = val;
1526 } else {
1527 int val = QMetaEnum::fromType<Color>().keyToValue(var.toByteArray());
1528 if (val != -1) {
1529 *rgba = val;
1530 } else {
1532 if (!color.isValid()) {
1533 qmlWarning(parent()) << "unknown Material." << name << " value: " << var.toString();
1534 return false;
1535 }
1536 *custom = true;
1537 *rgba = color.rgba();
1538 }
1539 }
1540 return true;
1541}
1542
1544
1545#include "moc_qquickmaterialstyle_p.cpp"
\inmodule QtCore
Definition qbytearray.h:57
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
Definition qbytearray.h:107
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
void setHslF(float h, float s, float l, float a=1.0)
Definition qcolor.cpp:1185
void setAlphaF(float alpha)
Sets the alpha of this color to alpha.
Definition qcolor.cpp:1511
static QColor fromRgb(QRgb rgb) noexcept
Static convenience function that returns a QColor constructed from the given QRgb value rgb.
Definition qcolor.cpp:2369
static QColor fromRgba(QRgb rgba) noexcept
Static convenience function that returns a QColor constructed from the given QRgb value rgba.
Definition qcolor.cpp:2385
static QColor fromString(QAnyStringView name) noexcept
Definition qcolor.cpp:980
QColor toHsl() const noexcept
Creates and returns an HSL QColor based on this color.
Definition qcolor.cpp:2239
\inmodule QtCore
int keyToValue(const char *key, bool *ok=nullptr) const
Returns the integer value of the given enumeration key, or -1 if key is not defined.
int id(int=0) const
Definition qmetatype.h:475
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
The QQuickAttachedPropertyPropagator class provides a way to propagate attached properties.
QQuickAttachedPropertyPropagator * attachedParent() const
This function returns the attached parent of this attached object.
QList< QQuickAttachedPropertyPropagator * > attachedChildren() const
This function returns the attached children of this attached object.
void initialize()
Finds and sets the attached parent for this attached object, and then does the same for its children.
void inheritAccent(uint accent, bool custom)
void setContainerStyle(ContainerStyle containerStyle)
Q_INVOKABLE QColor color(Color color, Shade shade=Shade500) const
Q_INVOKABLE int buttonLeftPadding(bool flat, bool hasIcon) const
void primaryHighlightedTextColorChanged()
void inheritForeground(uint foreground, bool custom, bool has)
Q_INVOKABLE QColor buttonColor(Theme theme, const QVariant &background, const QVariant &accent, bool enabled, bool flat, bool highlighted, bool checked) const
QQuickMaterialStyle(QObject *parent=nullptr)
void inheritBackground(uint background, bool custom, bool has)
void setForeground(const QVariant &foreground)
void setElevation(int elevation)
Q_INVOKABLE int buttonRightPadding(bool flat, bool hasIcon, bool hasText) const
void setBackground(const QVariant &background)
void inheritTheme(Theme theme)
Q_INVOKABLE QColor shade(const QColor &color, Shade shade) const
void attachedParentChange(QQuickAttachedPropertyPropagator *newParent, QQuickAttachedPropertyPropagator *oldParent) override
This function is called whenever the attached parent of this QQuickAttachedPropertyPropagator changes...
void inheritPrimary(uint primary, bool custom)
void containerStyleChanged()
void setAccent(const QVariant &accent)
void setPrimary(const QVariant &accent)
static QQuickMaterialStyle * qmlAttachedProperties(QObject *object)
void setRoundedScale(RoundedScale roundedScale)
static QSharedPointer< QSettings > settings(const QString &group=QString())
static bool isDarkSystemTheme()
QVariant value(QAnyStringView key, const QVariant &defaultValue) const
Returns the value for setting key.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
int toInt(bool *ok=nullptr) const
Returns the variant as an int if the variant has userType() \l QMetaType::Int, \l QMetaType::Bool,...
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
QByteArray toByteArray() const
Returns the variant as a QByteArray if the variant has userType() \l QMetaType::QByteArray or \l QMet...
QMetaType metaType() const
#define this
Definition dialogs.cpp:9
Combined button and popup list for selecting options.
@ transparent
Definition qnamespace.h:47
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define qWarning
Definition qlogging.h:166
GLenum GLenum GLsizei count
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLuint color
[2]
GLuint name
GLuint GLfloat * val
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
static QByteArray resolveSetting(const QByteArray &env, const QSharedPointer< QSettings > &settings, const QString &name)
static const QRgb rippleColorLight
static const QRgb switchUncheckedTrackColorLight
static const QRgb secondaryTextColorDark
static bool globalPrimaryCustom
static bool globalForegroundCustom
static QQuickMaterialStyle::Theme effectiveTheme(QQuickMaterialStyle::Theme theme)
static const QRgb switchDisabledUncheckedIconColorDark
static const QRgb switchDisabledUncheckedTrackColorLight
static const QRgb iconDisabledColorLight
static const QRgb frameColorLight
static uint globalPrimary
static QByteArray resolveSetting(const QByteArray &env, const QSharedPointer< QSettings > &settings, const QString &name)
static Enum toEnumValue(const QByteArray &value, bool *ok)
static QT_BEGIN_NAMESPACE const QRgb colors[][14]
static bool hasGlobalForeground
static const QRgb frameColorDark
static const QRgb switchDisabledUncheckedIconColorLight
static const QRgb sliderDisabledColorLight
static const QRgb raisedButtonDisabledColorDark
static const QRgb backgroundColorLight
static QQuickMaterialStyle::Theme globalTheme
static const QRgb primaryTextColorDark
static QColor darkerShade(const QColor &color, qreal amount)
static const QRgb dividerColorLight
static const QRgb switchDisabledUncheckedTrackBorderColorDark
static bool hasGlobalBackground
static const QRgb secondaryTextColorLight
static uint globalAccent
static const QRgb primaryTextColorLight
static const QRgb raisedButtonDisabledColorLight
static const QRgb rippleColorDark
static const QRgb textFieldFilledContainerColorDark
static bool globalBackgroundCustom
static const QRgb iconDisabledColorDark
static const QRgb spinBoxDisabledIconColorLight
static const QRgb switchUncheckedTrackColorDark
static const QRgb sliderDisabledColorDark
static const QRgb iconColorLight
static bool globalAccentCustom
static const QRgb switchDisabledCheckedTrackColorDark
static const QRgb spinBoxDisabledIconColorDark
static const QRgb dialogColorDark
static const QRgb switchDisabledUncheckedTrackColorDark
static const QRgb backgroundColorDark
static const QRgb textFieldFilledContainerColorLight
static uint globalForeground
static QColor lighterShade(const QColor &color, qreal amount)
static const QRgb switchDisabledUncheckedTrackBorderColorLight
static const QRgb iconColorDark
static const QRgb hintTextColorLight
static const QRgb dividerColorDark
static QQuickMaterialStyle::Variant globalVariant
static const QRgb switchDisabledCheckedTrackColorLight
static const QRgb hintTextColorDark
static const QRgb raisedButtonColorLight
static uint globalBackground
static const QRgb raisedButtonColorDark
static const QRgb dialogColorLight
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
Definition qrgb.h:13
#define QStringLiteral(str)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
#define emit
#define Q_UNUSED(x)
unsigned int uint
Definition qtypes.h:34
double qreal
Definition qtypes.h:187
@ frameColorLight
QSettings settings("MySoft", "Star Runner")
[0]
QLayoutItem * child
[0]