1 | // Copyright (C) 2016 Research In Motion. |
---|---|
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 QQMLAPPLICATIONENGINE_H |
5 | #define QQMLAPPLICATIONENGINE_H |
6 | |
7 | #include <QtQml/qqmlengine.h> |
8 | |
9 | #include <QtCore/qurl.h> |
10 | #include <QtCore/qobject.h> |
11 | #include <QtCore/qlist.h> |
12 | |
13 | QT_BEGIN_NAMESPACE |
14 | |
15 | class QQmlApplicationEnginePrivate; |
16 | class Q_QML_EXPORT QQmlApplicationEngine : public QQmlEngine |
17 | { |
18 | Q_OBJECT |
19 | public: |
20 | QQmlApplicationEngine(QObject *parent = nullptr); |
21 | QQmlApplicationEngine(const QUrl &url, QObject *parent = nullptr); |
22 | explicit QQmlApplicationEngine(QAnyStringView uri, QAnyStringView typeName, |
23 | QObject *parent = nullptr); |
24 | QQmlApplicationEngine(const QString &filePath, QObject *parent = nullptr); |
25 | ~QQmlApplicationEngine() override; |
26 | |
27 | QList<QObject*> rootObjects() const; |
28 | |
29 | public Q_SLOTS: |
30 | void load(const QUrl &url); |
31 | void load(const QString &filePath); |
32 | void loadFromModule(QAnyStringView uri, QAnyStringView typeName); |
33 | void setInitialProperties(const QVariantMap &initialProperties); |
34 | void setExtraFileSelectors(const QStringList &extraFileSelectors); |
35 | void loadData(const QByteArray &data, const QUrl &url = QUrl()); |
36 | |
37 | Q_SIGNALS: |
38 | void objectCreated(QObject *object, const QUrl &url); |
39 | void objectCreationFailed(const QUrl &url); |
40 | |
41 | private: |
42 | Q_DISABLE_COPY(QQmlApplicationEngine) |
43 | Q_PRIVATE_SLOT(d_func(), void _q_loadTranslations()) |
44 | Q_DECLARE_PRIVATE(QQmlApplicationEngine) |
45 | }; |
46 | |
47 | QT_END_NAMESPACE |
48 | |
49 | #endif |
50 |