oboy/src/qt/main.cpp

31 lines
770 B
C++
Raw Normal View History

2019-05-11 15:56:42 +02:00
#include <QGuiApplication>
2016-03-06 21:33:37 +01:00
#include <QQmlApplicationEngine>
2019-05-11 15:56:42 +02:00
#include <iostream>
#include <string>
2016-03-06 21:33:37 +01:00
2019-05-08 23:09:31 +02:00
#include <caml/mlvalues.h>
#include <caml/callback.h>
2019-05-11 21:13:09 +02:00
#include "oboy.h"
2019-05-11 15:56:42 +02:00
2016-03-06 21:33:37 +01:00
int main(int argc, char *argv[])
{
2019-05-11 15:56:42 +02:00
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
2016-03-06 21:33:37 +01:00
2019-05-11 21:13:09 +02:00
qmlRegisterType<OBoy>("com.oboy.oboy", 1, 0, "OBoy");
2016-03-06 21:33:37 +01:00
QQmlApplicationEngine engine;
2019-05-11 15:56:42 +02:00
const QUrl url(QStringLiteral("qrc:/main.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
engine.load(url);
2016-03-06 21:33:37 +01:00
2019-05-11 21:13:09 +02:00
caml_main(argv);
2019-05-11 15:56:42 +02:00
2016-03-06 21:33:37 +01:00
return app.exec();
}