magpie/main_web.cpp
2023-11-22 20:13:33 -03:00

26 lines
663 B
C++

#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include "root.h"
int main(int argc, char *argv[]) {
Root* app = new Root(argc, argv);
std::cout << "Starting" << std::endl;
QQmlApplicationEngine* engine = new QQmlApplicationEngine();
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;
return 0;
}