2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2021 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0
|
2021-10-20 17:37:22 +03:00
|
|
|
|
|
|
|
|
#include <QGuiApplication>
|
|
|
|
|
#include <QQmlApplicationEngine>
|
|
|
|
|
|
2021-12-10 14:53:00 +02:00
|
|
|
#include "app_environment.h"
|
|
|
|
|
#include "import_qml_plugins.h"
|
|
|
|
|
|
2021-10-20 17:37:22 +03:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
|
{
|
2021-12-10 14:53:00 +02:00
|
|
|
set_qt_environment();
|
2021-10-20 17:37:22 +03:00
|
|
|
QGuiApplication app(argc, argv);
|
|
|
|
|
|
|
|
|
|
QQmlApplicationEngine engine;
|
|
|
|
|
const QUrl url(u"qrc:Main/main.qml"_qs);
|
|
|
|
|
QObject::connect(
|
|
|
|
|
&engine, &QQmlApplicationEngine::objectCreated, &app,
|
|
|
|
|
[url](QObject *obj, const QUrl &objUrl) {
|
|
|
|
|
if (!obj && url == objUrl)
|
|
|
|
|
QCoreApplication::exit(-1);
|
|
|
|
|
},
|
|
|
|
|
Qt::QueuedConnection);
|
|
|
|
|
|
|
|
|
|
engine.addImportPath(QCoreApplication::applicationDirPath() + "/qml");
|
|
|
|
|
engine.addImportPath(":/");
|
|
|
|
|
|
|
|
|
|
engine.load(url);
|
|
|
|
|
|
|
|
|
|
if (engine.rootObjects().isEmpty()) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
|
}
|