forked from berkbavas/QmlFlightInstruments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
62 lines (52 loc) · 1.66 KB
/
main.cpp
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "Animation.h"
#include "PrimaryFlightData.h"
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
int main(int argc, char *argv[])
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
const QUrl url1(QStringLiteral("qrc:/ExampleBasicSix.qml"));
QObject::connect(
&engine,
&QQmlApplicationEngine::objectCreated,
&app,
[url1](QObject *obj, const QUrl &objUrl) {
if (!obj && url1 == objUrl)
QCoreApplication::exit(-1);
},
Qt::QueuedConnection);
const QUrl url2(QStringLiteral("qrc:/ExampleEFIS.qml"));
QObject::connect(
&engine,
&QQmlApplicationEngine::objectCreated,
&app,
[url2](QObject *obj, const QUrl &objUrl) {
if (!obj && url2 == objUrl)
QCoreApplication::exit(-1);
},
Qt::QueuedConnection);
const QUrl url3(QStringLiteral("qrc:/ExampleMiscellaneousGauges.qml"));
QObject::connect(
&engine,
&QQmlApplicationEngine::objectCreated,
&app,
[url3](QObject *obj, const QUrl &objUrl) {
if (!obj && url3 == objUrl)
QCoreApplication::exit(-1);
},
Qt::QueuedConnection);
PrimaryFlightData *pfd = new PrimaryFlightData;
Animation *animation = new Animation;
animation->setPfd(pfd);
engine.rootContext()->setContextProperty("pfd", pfd);
engine.load(url1);
engine.load(url2);
engine.load(url3);
animation->init();
return app.exec();
}