32 lines
708 B
C++
32 lines
708 B
C++
#include <QGuiApplication>
|
|
#include <QQmlApplicationEngine>
|
|
|
|
#include "root.h"
|
|
|
|
int main(int argc, char *argv[]) {
|
|
Root app(argc, argv);
|
|
|
|
std::cout << "Starting" << std::endl;
|
|
QQmlApplicationEngine engine;
|
|
const QUrl url(u"qrc:qml/main.qml"_qs);
|
|
QObject::connect(
|
|
&engine, &QQmlApplicationEngine::objectCreated, &app,
|
|
[&url](QObject* obj, const QUrl& objUrl) {
|
|
if (!obj && url == objUrl)
|
|
QCoreApplication::exit(-2);
|
|
},
|
|
Qt::QueuedConnection);
|
|
|
|
engine.load(url);
|
|
if (engine.rootObjects().isEmpty())
|
|
return -1;
|
|
|
|
int result;
|
|
try {
|
|
result = app.exec();
|
|
} catch (...) {
|
|
}
|
|
|
|
return result;
|
|
}
|