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 QFONTDIALOG_P_H
5#define QFONTDIALOG_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17//
18
19#include <QtWidgets/private/qtwidgetsglobal_p.h>
20#include "private/qdialog_p.h"
21#include "qfontdatabase.h"
22#include "qfontdialog.h"
23#include <qpa/qplatformdialoghelper.h>
24#include "qsharedpointer.h"
25
26QT_REQUIRE_CONFIG(fontdialog);
27
28QT_BEGIN_NAMESPACE
29
30class QBoxLayout;
31class QCheckBox;
32class QComboBox;
33class QDialogButtonBox;
34class QFontListView;
35class QGroupBox;
36class QLabel;
37class QLineEdit;
38
39class Q_AUTOTEST_EXPORT QFontDialogPrivate : public QDialogPrivate
40{
41 Q_DECLARE_PUBLIC(QFontDialog)
42
43public:
44 QFontDialogPrivate();
45 ~QFontDialogPrivate();
46
47 QPlatformFontDialogHelper *platformFontDialogHelper() const
48 { return static_cast<QPlatformFontDialogHelper *>(platformHelper()); }
49
50 void updateFamilies();
51 void updateStyles();
52 void updateSizes();
53
54 static QFont getFont(bool *ok, const QFont &initial, QWidget *parent,
55 const QString &title, QFontDialog::FontDialogOptions options);
56
57 void init();
58 void _q_sizeChanged(const QString &);
59 void _q_familyHighlighted(int);
60 void _q_writingSystemHighlighted(int);
61 void _q_styleHighlighted(int);
62 void _q_sizeHighlighted(int);
63 void _q_updateSample();
64 void updateSampleFont(const QFont &newFont);
65 void retranslateStrings();
66
67 QLabel *familyAccel;
68 QLineEdit *familyEdit;
69 QFontListView *familyList;
70
71 QLabel *styleAccel;
72 QLineEdit *styleEdit;
73 QFontListView *styleList;
74
75 QLabel *sizeAccel;
76 QLineEdit *sizeEdit;
77 QFontListView *sizeList;
78
79 QGroupBox *effects;
80 QCheckBox *strikeout;
81 QCheckBox *underline;
82 QComboBox *color;
83
84 QGroupBox *sample;
85 QLineEdit *sampleEdit;
86
87 QLabel *writingSystemAccel;
88 QComboBox *writingSystemCombo;
89
90 QBoxLayout *buttonLayout;
91 QBoxLayout *effectsLayout;
92 QBoxLayout *sampleLayout;
93 QBoxLayout *sampleEditLayout;
94
95 QDialogButtonBox *buttonBox;
96
97 QString family;
98 QFontDatabase::WritingSystem writingSystem;
99 QString style;
100 int size;
101 bool smoothScalable;
102 QFont selectedFont;
103 QSharedPointer<QFontDialogOptions> options;
104 QPointer<QObject> receiverToDisconnectOnClose;
105 QByteArray memberToDisconnectOnClose;
106
107 bool canBeNativeDialog() const override;
108 void setVisible(bool visible) override;
109 void _q_runNativeAppModalPanel();
110
111private:
112 virtual void initHelper(QPlatformDialogHelper *) override;
113 virtual void helperPrepareShow(QPlatformDialogHelper *) override;
114};
115
116QT_END_NAMESPACE
117
118#endif // QFONTDIALOG_P_H
119

source code of qtbase/src/widgets/dialogs/qfontdialog_p.h