Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlapplicationengine.h
Go to the documentation of this file.
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// Qt-Security score:significant
4
5#ifndef QQMLAPPLICATIONENGINE_H
6#define QQMLAPPLICATIONENGINE_H
7
8#include <QtQml/qqmlengine.h>
9
10#include <QtCore/qurl.h>
11#include <QtCore/qobject.h>
12#include <QtCore/qlist.h>
13
14QT_BEGIN_NAMESPACE
15
16class QQmlApplicationEnginePrivate;
17class Q_QML_EXPORT QQmlApplicationEngine : public QQmlEngine
18{
19 Q_OBJECT
20public:
21 QQmlApplicationEngine(QObject *parent = nullptr);
22 QQmlApplicationEngine(const QUrl &url, QObject *parent = nullptr);
23 explicit QQmlApplicationEngine(QAnyStringView uri, QAnyStringView typeName,
24 QObject *parent = nullptr);
25 QQmlApplicationEngine(const QString &filePath, QObject *parent = nullptr);
26 ~QQmlApplicationEngine() override;
27
28 QList<QObject*> rootObjects() const;
29
30public Q_SLOTS:
31 void load(const QUrl &url);
32 void load(const QString &filePath);
33 void loadFromModule(QAnyStringView uri, QAnyStringView typeName);
34 void setInitialProperties(const QVariantMap &initialProperties);
35 void setExtraFileSelectors(const QStringList &extraFileSelectors);
36 void loadData(const QByteArray &data, const QUrl &url = QUrl());
37
38Q_SIGNALS:
39 void objectCreated(QObject *object, const QUrl &url);
40 void objectCreationFailed(const QUrl &url);
41
42private:
43 Q_DISABLE_COPY(QQmlApplicationEngine)
44 Q_PRIVATE_SLOT(d_func(), void _q_loadTranslations())
45 Q_DECLARE_PRIVATE(QQmlApplicationEngine)
46};
47
48QT_END_NAMESPACE
49
50#endif
QQmlApplicationEngine provides a convenient way to load an application from a single QML file.
static QUrl urlFromFilePath(const QString &filePath)
static QString translationsDirectoryFromLocalUrl(const QUrl &url)