-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.cpp
More file actions
46 lines (33 loc) · 1.13 KB
/
Copy pathmain.cpp
File metadata and controls
46 lines (33 loc) · 1.13 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
40
41
42
43
44
45
46
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <Building/building.h>
#include <Clicking/clicking.h>
#include <Keytranslator/keytranslator.h>
#include <Conf/conf.h>
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
Building building;
Clicking clicking;
KeyTranslator ktr;
Conf config;
building.config = &config;
clicking.config = &config;
config.create();
building.loopStart();
clicking.loopStart();
QQmlContext *ctx = engine.rootContext();
ctx->setContextProperty("Building", &building);
ctx->setContextProperty("Clicking", &clicking);
ctx->setContextProperty("keyTranslator", &ktr);
ctx->setContextProperty("Config", &config);
engine.rootContext()->setContextProperty("applicationDirPath", QGuiApplication::applicationDirPath());
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
qputenv("QT_QUICK_CONTROLS_STYLE", "material");
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}