DtkWidget
DTK Widget module
载入中...
搜索中...
未找到
dfontcombobox.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2021 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DFONTCOMBOBOX_H
6#define DFONTCOMBOBOX_H
7
8#include <dtkwidget_global.h>
9#include <DComboBox>
10#include <QFontComboBox>
11
12QT_REQUIRE_CONFIG(fontcombobox);
13
14DWIDGET_BEGIN_NAMESPACE
15
16class DFontComboBoxPrivate;
17class LIBDTKWIDGETSHARED_EXPORT DFontComboBox : public DComboBox
18{
19 Q_OBJECT
20 Q_PROPERTY(QFontDatabase::WritingSystem writingSystem READ writingSystem WRITE setWritingSystem)
21 Q_PROPERTY(QFontComboBox::FontFilters fontFilters READ fontFilters WRITE setFontFilters)
22 Q_PROPERTY(QFont currentFont READ currentFont WRITE setCurrentFont NOTIFY currentFontChanged)
23
24public:
25 explicit DFontComboBox(QWidget *parent = nullptr);
26 virtual ~DFontComboBox() override;
27
28 void setWritingSystem(QFontDatabase::WritingSystem);
29 QFontDatabase::WritingSystem writingSystem() const;
30
31 void setFontFilters(QFontComboBox::FontFilters filters);
32 QFontComboBox::FontFilters fontFilters() const;
33
34 QFont currentFont() const;
35 virtual QSize sizeHint() const override;
36
37public Q_SLOTS:
38 void setCurrentFont(const QFont &f);
39
40Q_SIGNALS:
41 void currentFontChanged(const QFont &f);
42
43protected:
44 virtual bool event(QEvent *e) override;
45
46private:
47 Q_DISABLE_COPY(DFontComboBox)
48 D_DECLARE_PRIVATE(DFontComboBox)
49};
50
51DWIDGET_END_NAMESPACE
52
53#endif // DFONTCOMBOBOX_H
DComboBox 重写QComboBox, 提供一个下拉列表供用户选择
Definition dcombobox.h:16
继承自 DComboBox类 字体选择下拉列表
Definition dfontcombobox.h:18
QFont currentFont() const
与 QFontComboBox::currentFont 功能相同, 返回当前选择字体
virtual QSize sizeHint() const override
与 QFontComboBox::sizeHint 功能相同, 返回字体选择器的推荐大小
DFontComboBox(QWidget *parent=nullptr)
DFontComboBox 构造函数
void setCurrentFont(const QFont &f)
与 QFontComboBox::setCurrentFont 功能相同, 设置当前选择字体
void setWritingSystem(QFontDatabase::WritingSystem)
与 QFontComboBox::setWritingSystem 功能相同, 设置字体选择器所使用的书写系统
QFontComboBox::FontFilters fontFilters() const
与 QFontComboBox::fontFilters 功能相同, 返回字体选择器可以显示的字体
void setFontFilters(QFontComboBox::FontFilters filters)
与 QFontComboBox::setFontFilters 功能相同, 设置字体选择器可以显示的字体
virtual bool event(QEvent *e) override
与 QFontComboBox::event 功能相同, 返回 DComboBox::event(e)的布尔值
QFontDatabase::WritingSystem writingSystem() const
与 QFontComboBox::writingSystem 功能相同, 返回字体选择器所使用的书写系统