4#include <QtQuickTemplates2/private/qquicktheme_p.h>
5#include <QtQuick/private/qquickpalette_p.h>
6#include <QtGui/private/qguiapplication_p.h>
7#include <QtGui/qpa/qplatformtheme.h>
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
53 case QQStyleKitReader::ControlType::AbstractButton:
54 case QQStyleKitReader::ControlType::Button:
55 case QQStyleKitReader::ControlType::FlatButton:
56 return QQuickTheme::Button;
57 case QQStyleKitReader::ControlType::CheckBox:
58 return QQuickTheme::CheckBox;
59 case QQStyleKitReader::ControlType::ComboBox:
60 return QQuickTheme::ComboBox;
61 case QQStyleKitReader::ControlType::GroupBox:
62 return QQuickTheme::GroupBox;
63 case QQStyleKitReader::ControlType::ItemDelegate:
64 return QQuickTheme::ItemView;
65 case QQStyleKitReader::ControlType::Label:
66 return QQuickTheme::Label;
67 case QQStyleKitReader::ControlType::RadioButton:
68 return QQuickTheme::RadioButton;
69 case QQStyleKitReader::ControlType::SpinBox:
70 return QQuickTheme::SpinBox;
71 case QQStyleKitReader::ControlType::SwitchControl:
72 return QQuickTheme::Switch;
73 case QQStyleKitReader::ControlType::TabBar:
74 case QQStyleKitReader::ControlType::TabButton:
75 return QQuickTheme::TabBar;
76 case QQStyleKitReader::ControlType::TextArea:
77 return QQuickTheme::TextArea;
78 case QQStyleKitReader::ControlType::TextInput:
79 case QQStyleKitReader::ControlType::TextField:
80 return QQuickTheme::TextField;
81 case QQStyleKitReader::ControlType::ToolBar:
82 case QQStyleKitReader::ControlType::ToolButton:
83 case QQStyleKitReader::ControlType::ToolSeparator:
84 return QQuickTheme::ToolBar;
86 return QQuickTheme::System;
98 QObject *parentObj = parent();
107 const QQuickTheme::Scope scope = scopeForType(type);
108 return m_effectivePalettes[
int(scope)];
113 const QQuickTheme::Scope scope = scopeForType(type);
114 return m_effectiveFonts[
int(scope)];
124 QVector<
const QQStyleKitPalette *> fbChain;
125 for (
auto *fb = pals; fb; fb = fb->fallbackPalette())
128 auto resolveFromPaletteChain = [&](QQuickTheme::Scope scope,
129 QQuickPalette* (QQStyleKitPalette::*getter)()
const) -> QPalette
134 for (
int i = fbChain.size() - 1; i >= 0; --i) {
135 const QQStyleKitPalette *fb = fbChain[i];
136 if (fb->isSet(scope)) {
137 if (
auto *p = (fb->*getter)())
138 result = p->toQPalette().resolve(result);
140 if (scope != QQuickTheme::System && fb->isSet(QQuickTheme::System)) {
141 if (
auto *sys = fb->system())
142 result = sys->toQPalette().resolve(result);
149 auto setResolved = [&](QQuickPalette* (QQStyleKitPalette::*getter)()
const,
150 QQuickTheme::Scope scope)
152 m_effectivePalettes[
int(scope)] = resolveFromPaletteChain(scope, getter);
172 const QQStyleKitFont *fonts =
this->fonts();
177 QVector<
const QQStyleKitFont *> fbChain;
178 for (
auto *fb = fonts; fb; fb = fb->fallbackFont())
181 auto resolveFromFontChain = [&](QQuickTheme::Scope scope) -> QFont
186 for (
int i = fbChain.size() - 1; i >= 0; --i) {
187 const QQStyleKitFont *fb = fbChain[i];
188 if (fb->isSet(scope)) {
189 result = fb->fontForScope(scope).resolve(result);
191 if (scope != QQuickTheme::System && fb->isSet(QQuickTheme::System)) {
192 result = fb->fontForScope(QQuickTheme::System).resolve(result);
199 for (
int i = 0; i < NScopes; ++i) {
200 const QQuickTheme::Scope scope =
static_cast<QQuickTheme::Scope>(i);
201 m_effectiveFonts[i] = resolveFromFontChain(scope);
213#include "moc_qqstylekittheme_p.cpp"
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
QQuickPalette * groupBox() const
QQuickPalette * checkBox() const
QQuickPalette * toolBar() const
QQuickPalette * textField() const
QQuickPalette * spinBox() const
QQuickPalette * system() const
QQuickPalette * comboBox() const
QQuickPalette * itemDelegate() const
QQuickPalette * button() const
QQuickPalette * radioButton() const
QQuickPalette * textArea() const
QQuickPalette * tabBar() const
QQuickPalette * label() const
QQStyleKitPalette * palettes()
QQStyleKitStyle * style() const
QFont fontForControlType(QQStyleKitExtendableControlType type) const
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
QPalette paletteForControlType(QQStyleKitExtendableControlType type) const
Combined button and popup list for selecting options.
static QT_BEGIN_NAMESPACE QQuickTheme::Scope scopeForType(QQStyleKitExtendableControlType type)
\qmltype Theme \inqmlmodule Qt.labs.StyleKit \inherits AbstractStyle