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 QQUICKFONTLOADER_H |
5 | #define QQUICKFONTLOADER_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 | #include <private/qtquickglobal_p.h> |
19 | |
20 | #include <QtQml/qqml.h> |
21 | |
22 | #include <QtCore/qobject.h> |
23 | #include <QtCore/qurl.h> |
24 | |
25 | QT_BEGIN_NAMESPACE |
26 | |
27 | class QQuickFontLoaderPrivate; |
28 | class Q_QUICK_PRIVATE_EXPORT QQuickFontLoader : public QObject |
29 | { |
30 | Q_OBJECT |
31 | Q_DECLARE_PRIVATE(QQuickFontLoader) |
32 | |
33 | Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged FINAL) |
34 | Q_PROPERTY(QString name READ name NOTIFY nameChanged FINAL) |
35 | Q_PROPERTY(Status status READ status NOTIFY statusChanged FINAL) |
36 | Q_PROPERTY(QFont font READ font NOTIFY fontChanged FINAL) |
37 | QML_NAMED_ELEMENT(FontLoader) |
38 | QML_ADDED_IN_VERSION(2, 0) |
39 | |
40 | public: |
41 | enum Status { Null = 0, Ready, Loading, Error }; |
42 | Q_ENUM(Status) |
43 | |
44 | QQuickFontLoader(QObject *parent = nullptr); |
45 | |
46 | QUrl source() const; |
47 | void setSource(const QUrl &url); |
48 | |
49 | QString name() const; |
50 | |
51 | QFont font() const; |
52 | |
53 | Status status() const; |
54 | |
55 | private Q_SLOTS: |
56 | void updateFontInfo(int); |
57 | |
58 | Q_SIGNALS: |
59 | void sourceChanged(); |
60 | void nameChanged(); |
61 | void fontChanged(); |
62 | void statusChanged(); |
63 | }; |
64 | |
65 | QT_END_NAMESPACE |
66 | |
67 | QML_DECLARE_TYPE(QQuickFontLoader) |
68 | |
69 | #endif // QQUICKFONTLOADER_H |
70 | |
71 | |