Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqstylekitfont_p.h
Go to the documentation of this file.
1// Copyright (C) 2025 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// Qt-Security score:significant reason:default
4
5#ifndef QQSTYLEKITFONT_H
6#define QQSTYLEKITFONT_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQml/QtQml>
20#include <QtQuickTemplates2/private/qquicktheme_p.h>
21#include <QtGui/qfont.h>
22
24
25class QQStyleKitFont : public QObject
26{
27 Q_OBJECT
28 Q_PROPERTY(QFont system READ system WRITE setSystem NOTIFY systemChanged FINAL)
29 Q_PROPERTY(QFont button READ button WRITE setButton NOTIFY buttonChanged FINAL)
30 Q_PROPERTY(QFont checkBox READ checkBox WRITE setCheckBox NOTIFY checkBoxChanged FINAL)
31 Q_PROPERTY(QFont comboBox READ comboBox WRITE setComboBox NOTIFY comboBoxChanged FINAL)
32 Q_PROPERTY(QFont groupBox READ groupBox WRITE setGroupBox NOTIFY groupBoxChanged FINAL)
33 Q_PROPERTY(QFont itemView READ itemView WRITE setItemView NOTIFY itemViewChanged FINAL)
34 Q_PROPERTY(QFont label READ label WRITE setLabel NOTIFY labelChanged FINAL)
35 Q_PROPERTY(QFont listView READ listView WRITE setListView NOTIFY listViewChanged FINAL)
36 Q_PROPERTY(QFont menu READ menu WRITE setMenu NOTIFY menuChanged FINAL)
37 Q_PROPERTY(QFont menuBar READ menuBar WRITE setMenuBar NOTIFY menuBarChanged FINAL)
38 Q_PROPERTY(QFont radioButton READ radioButton WRITE setRadioButton NOTIFY radioButtonChanged FINAL)
39 Q_PROPERTY(QFont spinBox READ spinBox WRITE setSpinBox NOTIFY spinBoxChanged FINAL)
40 Q_PROPERTY(QFont switchControl READ switchControl WRITE setSwitchControl NOTIFY switchControlChanged FINAL)
41 Q_PROPERTY(QFont tabBar READ tabBar WRITE setTabBar NOTIFY tabBarChanged FINAL)
42 Q_PROPERTY(QFont textArea READ textArea WRITE setTextArea NOTIFY textAreaChanged FINAL)
43 Q_PROPERTY(QFont textField READ textField WRITE setTextField NOTIFY textFieldChanged FINAL)
44 Q_PROPERTY(QFont toolBar READ toolBar WRITE setToolBar NOTIFY toolBarChanged FINAL)
45 Q_PROPERTY(QFont toolTip READ toolTip WRITE setToolTip NOTIFY toolTipChanged FINAL)
46 Q_PROPERTY(QFont tumbler READ tumbler WRITE setTumbler NOTIFY tumblerChanged FINAL)
47
48 QML_NAMED_ELEMENT(StyleKitFont)
49
50public:
51 QQStyleKitFont(QObject *parent = nullptr);
52 QFont system() const;
53 void setSystem(const QFont &font);
54
55 QFont button() const;
56 void setButton(const QFont &font);
57
58 QFont checkBox() const;
59 void setCheckBox(const QFont &font);
60
61 QFont comboBox() const;
62 void setComboBox(const QFont &font);
63
64 QFont groupBox() const;
65 void setGroupBox(const QFont &font);
66
67 QFont itemView() const;
68 void setItemView(const QFont &font);
69
70 QFont label() const;
71 void setLabel(const QFont &font);
72
73 QFont listView() const;
74 void setListView(const QFont &font);
75
76 QFont menu() const;
77 void setMenu(const QFont &font);
78
79 QFont menuBar() const;
80 void setMenuBar(const QFont &font);
81
82 QFont radioButton() const;
83 void setRadioButton(const QFont &font);
84
85 QFont spinBox() const;
86 void setSpinBox(const QFont &font);
87
88 QFont switchControl() const;
89 void setSwitchControl(const QFont &font);
90
91 QFont tabBar() const;
92 void setTabBar(const QFont &font);
93
94 QFont textArea() const;
95 void setTextArea(const QFont &font);
96
97 QFont textField() const;
98 void setTextField(const QFont &font);
99
100 QFont toolBar() const;
101 void setToolBar(const QFont &font);
102
103 QFont toolTip() const;
104 void setToolTip(const QFont &font);
105
106 QFont tumbler() const;
107 void setTumbler(const QFont &font);
108
109 QQStyleKitFont *fallbackFont() const;
110 void setFallbackFont(QQStyleKitFont *fallback);
111
112 QFont fontForScope(QQuickTheme::Scope scope) const;
113
114signals:
115 void systemChanged();
116 void buttonChanged();
117 void checkBoxChanged();
118 void comboBoxChanged();
119 void groupBoxChanged();
120 void itemViewChanged();
121 void labelChanged();
122 void listViewChanged();
123 void menuChanged();
124 void menuBarChanged();
125 void radioButtonChanged();
126 void spinBoxChanged();
127 void switchControlChanged();
128 void tabBarChanged();
129 void textAreaChanged();
130 void textFieldChanged();
131 void toolBarChanged();
132 void toolTipChanged();
133 void tumblerChanged();
134 void fallbackFontChanged();
135
136private:
137 Q_DISABLE_COPY(QQStyleKitFont)
138
139 void setFontForScope(QQuickTheme::Scope scope, const QFont &font, void (QQStyleKitFont::*signal)());
140
141 bool isSet(QQuickTheme::Scope scope) const { return (m_setMask & (1u << int(scope))) != 0; }
142 void markSet(QQuickTheme::Scope scope) { m_setMask |= (1u << int(scope)); }
143
144 static const int NScopes = QQuickTheme::Tumbler + 1;
145 QFont m_fonts[NScopes];
146 quint32 m_setMask = 0;
147
148 QQStyleKitFont *m_fallback = nullptr;
149
150 friend class QQStyleKitTheme;
151};
152
153QT_END_NAMESPACE
154
155#endif // QQSTYLEKITFONT_H
Q_INVOKABLE bool styleLoaded() const
void setStyleUrl(const QString &styleUrl)
QQStyleKitStyle * style() const
void transitionsEnabledChanged()
void setStyle(QQStyleKitStyle *style)
void setTransitionsEnabled(bool enabled)
QQStyleKitDebug * debug() const
bool transitionsEnabled() const
QString styleUrl() const
void filterChanged()
QString filter() const
void setFilter(const QString &filter)
void setControl(QQuickItem *item)
static Q_INVOKABLE bool insideControl(const QObject *child)
void setType(QQStyleKitExtendableControlType type)
QVariant readStyleProperty(PropertyStorageId key) const
void setHovered(bool hovered)
void setPressed(bool pressed)
void effectiveFontChanged()
void customTypeChanged()
static bool transitionEnabled()
QQSK::State controlState() const
void setFocused(bool focused)
void setPalette(QQuickPalette *palette)
static void setTransitionEnabled(bool enabled)
QFont effectiveFont() const
void setFont(const QFont &font)
QQStyleKitExtendableControlType type() const
QQStyleKitControlProperties * global() const
QPalette effectivePalette() const
static QList< QQStyleKitReader * > s_allReaders
void propertiesChanged()
void verticalChanged()
void highlightedChanged()
void setVertical(bool vertical)
QQuickPalette * palette() const
void setEnabled(bool enabled)
void setHighlighted(bool highlighted)
void setChecked(bool checked)
void writeStyleProperty(PropertyStorageId key, const QVariant &value)
void customThemeNamesChanged()
void themeNamesChanged()
QList< QQStyleKitCustomTheme * > customThemes() const
QStringList themeNames() const
void themeNameChanged()
QQmlComponent * dark() const
QQmlComponent * light() const
QStringList customThemeNames() const
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
QQStyleKitStyle * fallbackStyle() const
QQStyleKitTheme * theme() const
void fallbackStyleChanged()
static QQStyleKitStyle * current()
QQuickPalette * palette() const
void setThemeName(const QString &themeName)
void setDark(QQmlComponent *darkTheme)
QPalette paletteForControlType(QQStyleKitExtendableControlType type) const
QFont fontForControlType(QQStyleKitExtendableControlType type) const
void setLight(QQmlComponent *lightTheme)
QString themeName() const
void setFallbackStyle(QQStyleKitStyle *fallbackStyle)
static QQStyleKitAttached * qmlAttachedProperties(QObject *obj=nullptr)
Combined button and popup list for selecting options.