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 itemDelegate READ itemDelegate WRITE setItemDelegate NOTIFY itemDelegateChanged FINAL)
34 Q_PROPERTY(QFont label READ label WRITE setLabel NOTIFY labelChanged FINAL)
35 Q_PROPERTY(QFont radioButton READ radioButton WRITE setRadioButton NOTIFY radioButtonChanged FINAL)
36 Q_PROPERTY(QFont spinBox READ spinBox WRITE setSpinBox NOTIFY spinBoxChanged FINAL)
37 Q_PROPERTY(QFont switchControl READ switchControl WRITE setSwitchControl NOTIFY switchControlChanged FINAL)
38 Q_PROPERTY(QFont tabBar READ tabBar WRITE setTabBar NOTIFY tabBarChanged FINAL)
39 Q_PROPERTY(QFont textArea READ textArea WRITE setTextArea NOTIFY textAreaChanged FINAL)
40 Q_PROPERTY(QFont textField READ textField WRITE setTextField NOTIFY textFieldChanged FINAL)
41 Q_PROPERTY(QFont toolBar READ toolBar WRITE setToolBar NOTIFY toolBarChanged FINAL)
42
43 QML_NAMED_ELEMENT(StyleFont)
44
45public:
46 QQStyleKitFont(QObject *parent = nullptr);
47 QFont system() const;
48 void setSystem(const QFont &font);
49
50 QFont button() const;
51 void setButton(const QFont &font);
52
53 QFont checkBox() const;
54 void setCheckBox(const QFont &font);
55
56 QFont comboBox() const;
57 void setComboBox(const QFont &font);
58
59 QFont groupBox() const;
60 void setGroupBox(const QFont &font);
61
62 QFont itemDelegate() const;
63 void setItemDelegate(const QFont &font);
64
65 QFont label() const;
66 void setLabel(const QFont &font);
67
68 QFont radioButton() const;
69 void setRadioButton(const QFont &font);
70
71 QFont spinBox() const;
72 void setSpinBox(const QFont &font);
73
74 QFont switchControl() const;
75 void setSwitchControl(const QFont &font);
76
77 QFont tabBar() const;
78 void setTabBar(const QFont &font);
79
80 QFont textArea() const;
81 void setTextArea(const QFont &font);
82
83 QFont textField() const;
84 void setTextField(const QFont &font);
85
86 QFont toolBar() const;
87 void setToolBar(const QFont &font);
88
89 QQStyleKitFont *fallbackFont() const;
90 void setFallbackFont(QQStyleKitFont *fallback);
91
92signals:
93 void systemChanged();
94 void buttonChanged();
95 void checkBoxChanged();
96 void comboBoxChanged();
97 void groupBoxChanged();
98 void itemDelegateChanged();
99 void labelChanged();
100 void radioButtonChanged();
101 void spinBoxChanged();
102 void switchControlChanged();
103 void tabBarChanged();
104 void textAreaChanged();
105 void textFieldChanged();
106 void toolBarChanged();
107 void fallbackFontChanged();
108
109private:
110 Q_DISABLE_COPY(QQStyleKitFont)
111
112 QFont fontForScope(QQuickTheme::Scope scope) const;
113 void setFontForScope(QQuickTheme::Scope scope, const QFont &font, void (QQStyleKitFont::*signal)());
114
115 bool isSet(QQuickTheme::Scope scope) const { return (m_setMask & (1u << int(scope))) != 0; }
116 void markSet(QQuickTheme::Scope scope) { m_setMask |= (1u << int(scope)); }
117
118 static const int NScopes = QQuickTheme::Tumbler + 1;
119 QFont m_fonts[NScopes];
120 quint32 m_setMask = 0;
121
122 QQStyleKitFont *m_fallback = nullptr;
123
124 friend class QQStyleKitTheme;
125};
126
127QT_END_NAMESPACE
128
129#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)
QVariant readStyleProperty(PropertyStorageId key) const
void setHovered(bool hovered)
void setPressed(bool pressed)
void customTypeChanged()
static bool transitionEnabled()
QQSK::State controlState() const
void setFocused(bool focused)
void setPalette(QQuickPalette *palette)
static void setTransitionEnabled(bool enabled)
QQStyleKitControlProperties * global() const
void setControlType(QQStyleKitExtendableControlType type)
QPalette effectivePalette() const
static QList< QQStyleKitReader * > s_allReaders
void propertiesChanged()
void verticalChanged()
void highlightedChanged()
void setVertical(bool vertical)
QQStyleKitExtendableControlType controlType() const
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.