-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
39 lines (32 loc) · 1.24 KB
/
Copy pathmain.cpp
File metadata and controls
39 lines (32 loc) · 1.24 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
35
36
37
38
39
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <Controllers/system.h>
#include <Controllers/hvachandler.h>
#include <Controllers/lightcontrol.h>
int main(int argc, char *argv[])
{
qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
QGuiApplication app(argc, argv);
qmlRegisterType<System>("Controllers", 1, 0, "System");
qmlRegisterType<System>("Controllers", 1, 0, "HVACHandler");
// defining a system object
System m_systemHandler;
HVACHandler m_driverHVACHandler;
HVACHandler m_passengerHVACHandler;
LightControl m_lightControlHandler;
QQmlApplicationEngine engine;
QQmlContext * context(engine.rootContext());
context->setContextProperty("systemHandler", &m_systemHandler);
context->setContextProperty("driverHVAC", &m_driverHVACHandler);
context->setContextProperty("passengerHVAC", &m_passengerHVACHandler);
context->setContextProperty("lightControl", &m_lightControlHandler);
QObject::connect(
&engine,
&QQmlApplicationEngine::objectCreationFailed,
&app,
[]() { QCoreApplication::exit(-1); },
Qt::QueuedConnection);
engine.loadFromModule("InfotainmentSystem-UI", "Main");
return app.exec();
}