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 | |
25 | #include <QtCore/qpointer.h> |
26 | #include "qsharedpointer.h" |
27 | |
28 | QT_REQUIRE_CONFIG(fontdialog); |
29 | |
30 | QT_BEGIN_NAMESPACE |
31 | |
32 | class QBoxLayout; |
33 | class QCheckBox; |
34 | class QComboBox; |
35 | class QDialogButtonBox; |
36 | class QFontListView; |
37 | class QGroupBox; |
38 | class QLabel; |
39 | class QLineEdit; |
40 | |
41 | class Q_AUTOTEST_EXPORT QFontDialogPrivate : public QDialogPrivate |
42 | { |
43 | Q_DECLARE_PUBLIC(QFontDialog) |
44 | |
45 | public: |
46 | QFontDialogPrivate(); |
47 | ~QFontDialogPrivate(); |
48 | |
49 | QPlatformFontDialogHelper *platformFontDialogHelper() const |
50 | { return static_cast<QPlatformFontDialogHelper *>(platformHelper()); } |
51 | |
52 | void updateFamilies(); |
53 | void updateStyles(); |
54 | void updateSizes(); |
55 | |
56 | static QFont getFont(bool *ok, const QFont &initial, QWidget *parent, |
57 | const QString &title, QFontDialog::FontDialogOptions options); |
58 | |
59 | void init(); |
60 | void sizeChanged(const QString &); |
61 | void familyHighlighted(int); |
62 | void writingSystemHighlighted(int); |
63 | void styleHighlighted(int); |
64 | void sizeHighlighted(int); |
65 | void updateSample(); |
66 | void updateSampleFont(const QFont &newFont); |
67 | void retranslateStrings(); |
68 | |
69 | QLabel *familyAccel; |
70 | QLineEdit *familyEdit; |
71 | QFontListView *familyList; |
72 | |
73 | QLabel *styleAccel; |
74 | QLineEdit *styleEdit; |
75 | QFontListView *styleList; |
76 | |
77 | QLabel *sizeAccel; |
78 | QLineEdit *sizeEdit; |
79 | QFontListView *sizeList; |
80 | |
81 | QGroupBox *effects; |
82 | QCheckBox *strikeout; |
83 | QCheckBox *underline; |
84 | QComboBox *color; |
85 | |
86 | QGroupBox *sample; |
87 | QLineEdit *sampleEdit; |
88 | |
89 | QLabel *writingSystemAccel; |
90 | QComboBox *writingSystemCombo; |
91 | |
92 | QBoxLayout *buttonLayout; |
93 | QBoxLayout *effectsLayout; |
94 | QBoxLayout *sampleLayout; |
95 | QBoxLayout *sampleEditLayout; |
96 | |
97 | QDialogButtonBox *buttonBox; |
98 | |
99 | QString family; |
100 | QFontDatabase::WritingSystem writingSystem; |
101 | QString style; |
102 | int size; |
103 | bool smoothScalable; |
104 | QFont selectedFont; |
105 | QSharedPointer<QFontDialogOptions> options; |
106 | QPointer<QObject> receiverToDisconnectOnClose; |
107 | QByteArray memberToDisconnectOnClose; |
108 | |
109 | bool canBeNativeDialog() const override; |
110 | void setVisible(bool visible) override; |
111 | void _q_runNativeAppModalPanel(); |
112 | |
113 | private: |
114 | virtual void initHelper(QPlatformDialogHelper *) override; |
115 | virtual void helperPrepareShow(QPlatformDialogHelper *) override; |
116 | }; |
117 | |
118 | QT_END_NAMESPACE |
119 | |
120 | #endif // QFONTDIALOG_P_H |
121 | |