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#include <QtLabsStyleKit/qtlabsstylekitexports.h>
23
25
26class Q_LABSSTYLEKIT_EXPORT QQStyleKitFont : public QObject
27{
28 Q_OBJECT
29 Q_PROPERTY(QFont system READ system WRITE setSystem NOTIFY systemChanged FINAL)
30 Q_PROPERTY(QFont button READ button WRITE setButton NOTIFY buttonChanged FINAL)
31 Q_PROPERTY(QFont checkBox READ checkBox WRITE setCheckBox NOTIFY checkBoxChanged FINAL)
32 Q_PROPERTY(QFont comboBox READ comboBox WRITE setComboBox NOTIFY comboBoxChanged FINAL)
33 Q_PROPERTY(QFont groupBox READ groupBox WRITE setGroupBox NOTIFY groupBoxChanged FINAL)
34 Q_PROPERTY(QFont itemDelegate READ itemDelegate WRITE setItemDelegate NOTIFY itemDelegateChanged FINAL)
35 Q_PROPERTY(QFont label READ label WRITE setLabel NOTIFY labelChanged FINAL)
36 Q_PROPERTY(QFont radioButton READ radioButton WRITE setRadioButton NOTIFY radioButtonChanged FINAL)
37 Q_PROPERTY(QFont spinBox READ spinBox WRITE setSpinBox NOTIFY spinBoxChanged FINAL)
38 Q_PROPERTY(QFont switchControl READ switchControl WRITE setSwitchControl NOTIFY switchControlChanged FINAL)
39 Q_PROPERTY(QFont tabBar READ tabBar WRITE setTabBar NOTIFY tabBarChanged FINAL)
40 Q_PROPERTY(QFont textArea READ textArea WRITE setTextArea NOTIFY textAreaChanged FINAL)
41 Q_PROPERTY(QFont textField READ textField WRITE setTextField NOTIFY textFieldChanged FINAL)
42 Q_PROPERTY(QFont toolBar READ toolBar WRITE setToolBar NOTIFY toolBarChanged FINAL)
43
44 QML_NAMED_ELEMENT(StyleFont)
45
46public:
47 QQStyleKitFont(QObject *parent = nullptr);
48 QFont system() const;
49 void setSystem(const QFont &font);
50
51 QFont button() const;
52 void setButton(const QFont &font);
53
54 QFont checkBox() const;
55 void setCheckBox(const QFont &font);
56
57 QFont comboBox() const;
58 void setComboBox(const QFont &font);
59
60 QFont groupBox() const;
61 void setGroupBox(const QFont &font);
62
63 QFont itemDelegate() const;
64 void setItemDelegate(const QFont &font);
65
66 QFont label() const;
67 void setLabel(const QFont &font);
68
69 QFont radioButton() const;
70 void setRadioButton(const QFont &font);
71
72 QFont spinBox() const;
73 void setSpinBox(const QFont &font);
74
75 QFont switchControl() const;
76 void setSwitchControl(const QFont &font);
77
78 QFont tabBar() const;
79 void setTabBar(const QFont &font);
80
81 QFont textArea() const;
82 void setTextArea(const QFont &font);
83
84 QFont textField() const;
85 void setTextField(const QFont &font);
86
87 QFont toolBar() const;
88 void setToolBar(const QFont &font);
89
90 QQStyleKitFont *fallbackFont() const;
91 void setFallbackFont(QQStyleKitFont *fallback);
92
93signals:
94 void systemChanged();
95 void buttonChanged();
96 void checkBoxChanged();
97 void comboBoxChanged();
98 void groupBoxChanged();
99 void itemDelegateChanged();
100 void labelChanged();
101 void radioButtonChanged();
102 void spinBoxChanged();
103 void switchControlChanged();
104 void tabBarChanged();
105 void textAreaChanged();
106 void textFieldChanged();
107 void toolBarChanged();
108 void fallbackFontChanged();
109
110private:
111 Q_DISABLE_COPY(QQStyleKitFont)
112
113 QFont fontForScope(QQuickTheme::Scope scope) const;
114 void setFontForScope(QQuickTheme::Scope scope, const QFont &font, void (QQStyleKitFont::*signal)());
115
116 bool isSet(QQuickTheme::Scope scope) const { return (m_setMask & (1u << int(scope))) != 0; }
117 void markSet(QQuickTheme::Scope scope) { m_setMask |= (1u << int(scope)); }
118
119 static const int NScopes = QQuickTheme::Tumbler + 1;
120 QFont m_fonts[NScopes];
121 quint32 m_setMask = 0;
122
123 QQStyleKitFont *m_fallback = nullptr;
124
125 friend class QQStyleKitTheme;
126};
127
128QT_END_NAMESPACE
129
130#endif // QQSTYLEKITFONT_H
void filterChanged()
QString filter() const
void setFilter(const QString &filter)
void setControl(QQuickItem *item)
static Q_INVOKABLE bool insideControl(const QObject *child)
Combined button and popup list for selecting options.