-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (28 loc) · 1.3 KB
/
main.cpp
File metadata and controls
34 lines (28 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <messagegenerator.h>
#include <DynamicGui/DynamicGuiController.h>
#include <UdpVideo/UdpVideoController.h>
#include "PluginLoader.h"
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
qmlRegisterType<MessageGenerator>("io.qt.MessageGenerator", 1, 0, "MessageGenerator");
qmlRegisterType<DynamicGuiController>("io.qt.DynamicGuiController", 1, 0, "DynamicGuiController");
qmlRegisterType<UdpVideoController>("io.qt.UdpVideoController", 1, 0, "UdpVideoController");
qmlRegisterType<PluginLoader>("io.qt.PluginLoader", 1, 0, "PluginLoader");
QQmlApplicationEngine engine;
engine.addImportPath(QStringLiteral(":/qml/"));
engine.addImportPath(QStringLiteral(":/qml/design/"));
engine.addImportPath(QStringLiteral(":/qml/CommonItems/"));
engine.addImportPath(QStringLiteral("qrc:/"));
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);
return app.exec();
}