LedDisplay/OmobiDisplayApp/main.cpp

42 lines
1.4 KiB
C++
Raw Normal View History

2020-10-08 20:06:57 +02:00
#include <QGuiApplication>
#include <QQmlApplicationEngine>
2020-10-11 15:50:13 +02:00
#include <QQuickStyle>
#include <qbluetoothleuartclient.h>
#include <QTranslator>
#include <QFontDatabase>
2020-10-08 20:06:57 +02:00
#include "omobidisplaybackend.h"
2020-10-11 21:01:21 +02:00
#include "omobidisplaytextmodel.h"
2020-10-08 20:06:57 +02:00
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setOrganizationName("Itsblue");
QCoreApplication::setOrganizationDomain("itsblue.de");
QCoreApplication::setApplicationName("Itsblue smart display");
2020-10-08 20:06:57 +02:00
QGuiApplication app(argc, argv);
QTranslator translator;
translator.load(":/" + QLocale::system().name() + ".qm");
app.installTranslator(&translator);
2020-10-09 00:03:50 +02:00
qmlRegisterType<OmobiDisplayBackend>("de.itsblue.omobidisplayapp", 1, 0, "OmobiDisplayBackend");
2020-10-11 21:01:21 +02:00
qmlRegisterUncreatableType<OmobiDisplayTextModel>("de.itsblue.omobidisplayapp", 1, 0, "OmobiDisplayTextModel", "OmobiDisplayTextModel cannot be created");
QBluetoothLeUartClient::init();
2020-10-08 20:06:57 +02:00
2020-10-11 15:50:13 +02:00
QQuickStyle::setStyle("Material");
2020-10-08 20:06:57 +02:00
QQmlApplicationEngine engine;
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);
2020-10-09 00:03:50 +02:00
2020-10-08 20:06:57 +02:00
return app.exec();
}