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 | // |
5 | // W A R N I N G |
6 | // ------------- |
7 | // |
8 | // This file is not part of the Qt API. It exists for the convenience |
9 | // of the Qt tools. This header |
10 | // file may change from version to version without notice, or even be removed. |
11 | // |
12 | // We mean it. |
13 | // |
14 | |
15 | #ifndef FONTPANEL_H |
16 | #define FONTPANEL_H |
17 | |
18 | #include <QtWidgets/QGroupBox> |
19 | #include <QtGui/QFont> |
20 | #include <QtGui/QFontDatabase> |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | class QComboBox; |
25 | class QFontComboBox; |
26 | class QTimer; |
27 | class QLineEdit; |
28 | |
29 | class FontPanel: public QGroupBox |
30 | { |
31 | Q_OBJECT |
32 | public: |
33 | FontPanel(QWidget *parentWidget = 0); |
34 | |
35 | QFont selectedFont() const; |
36 | void setSelectedFont(const QFont &); |
37 | |
38 | QFontDatabase::WritingSystem writingSystem() const; |
39 | void setWritingSystem(QFontDatabase::WritingSystem ws); |
40 | |
41 | private slots: |
42 | void slotWritingSystemChanged(int); |
43 | void slotFamilyChanged(const QFont &); |
44 | void slotStyleChanged(int); |
45 | void slotPointSizeChanged(int); |
46 | void slotUpdatePreviewFont(); |
47 | |
48 | private: |
49 | QString family() const; |
50 | QString styleString() const; |
51 | int pointSize() const; |
52 | int closestPointSizeIndex(int ps) const; |
53 | |
54 | void updateWritingSystem(QFontDatabase::WritingSystem ws); |
55 | void updateFamily(const QString &family); |
56 | void updatePointSizes(const QString &family, const QString &style); |
57 | void delayedPreviewFontUpdate(); |
58 | |
59 | QLineEdit *m_previewLineEdit; |
60 | QComboBox *m_writingSystemComboBox; |
61 | QFontComboBox* m_familyComboBox; |
62 | QComboBox *m_styleComboBox; |
63 | QComboBox *m_pointSizeComboBox; |
64 | QTimer *m_previewFontUpdateTimer; |
65 | }; |
66 | |
67 | QT_END_NAMESPACE |
68 | |
69 | #endif // FONTPANEL_H |
70 | |