Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qfontcombobox.h
Go to the documentation of this file.
1// Copyright (C) 2016 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
4#ifndef QFONTCOMBOBOX_H
5#define QFONTCOMBOBOX_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qcombobox.h>
9#include <QtGui/qfontdatabase.h>
10
11QT_REQUIRE_CONFIG(fontcombobox);
12
14
16
17class Q_WIDGETS_EXPORT QFontComboBox : public QComboBox
18{
20 Q_PROPERTY(QFontDatabase::WritingSystem writingSystem READ writingSystem WRITE setWritingSystem)
21 Q_PROPERTY(FontFilters fontFilters READ fontFilters WRITE setFontFilters)
22 Q_PROPERTY(QFont currentFont READ currentFont WRITE setCurrentFont NOTIFY currentFontChanged)
23
24public:
25 explicit QFontComboBox(QWidget *parent = nullptr);
27
28 void setWritingSystem(QFontDatabase::WritingSystem);
29 QFontDatabase::WritingSystem writingSystem() const;
30
32 AllFonts = 0,
33 ScalableFonts = 0x1,
34 NonScalableFonts = 0x2,
35 MonospacedFonts = 0x4,
36 ProportionalFonts = 0x8
37 };
38 Q_DECLARE_FLAGS(FontFilters, FontFilter)
39 Q_FLAG(FontFilters)
40
41 void setFontFilters(FontFilters filters);
42 FontFilters fontFilters() const;
43
44 QFont currentFont() const;
45 QSize sizeHint() const override;
46
47 void setSampleTextForSystem(QFontDatabase::WritingSystem writingSystem, const QString &sampleText);
48 QString sampleTextForSystem(QFontDatabase::WritingSystem writingSystem) const;
49
50 void setSampleTextForFont(const QString &fontFamily, const QString &sampleText);
51 QString sampleTextForFont(const QString &fontFamily) const;
52
53 void setDisplayFont(const QString &fontFamily, const QFont &font);
54 std::optional<QFont> displayFont(const QString &fontFamily) const;
55
56public Q_SLOTS:
57 void setCurrentFont(const QFont &f);
58
61
62protected:
63 bool event(QEvent *e) override;
64
65private:
66 Q_DISABLE_COPY(QFontComboBox)
67 Q_DECLARE_PRIVATE(QFontComboBox)
68 Q_PRIVATE_SLOT(d_func(), void _q_currentChanged(const QString &))
69 Q_PRIVATE_SLOT(d_func(), void _q_updateModel())
70};
71
72Q_DECLARE_OPERATORS_FOR_FLAGS(QFontComboBox::FontFilters)
73
75
76#endif
The QComboBox widget is a combined button and popup list.
Definition qcombobox.h:24
QSize sizeHint() const override
\reimp
\inmodule QtCore
Definition qcoreevent.h:45
The QFontComboBox widget is a combobox that lets the user select a font family.
void currentFontChanged(const QFont &f)
This signal is emitted whenever the current font changes, with the new font.
FontFilter
This enum can be used to only show certain types of fonts in the font combo box.
WritingSystem
\value Any \value Latin \value Greek \value Cyrillic \value Armenian \value Hebrew \value Arabic \val...
\reentrant
Definition qfont.h:20
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
double e
Combined button and popup list for selecting options.
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
GLfloat GLfloat f
struct _cl_event * event
#define QT_REQUIRE_CONFIG(feature)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_FLAG(x)
#define Q_SLOTS
#define Q_PRIVATE_SLOT(d, signature)
#define Q_SIGNALS
const QStringList filters({"Image files (*.png *.xpm *.jpg)", "Text files (*.txt)", "Any files (*)" })
[6]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent