-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
executable file
·39 lines (28 loc) · 855 Bytes
/
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
#include <QtGlobal>
#ifdef Q_OS_LINUX
#include <QApplication>
#endif
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QFontDatabase>
#include "worker.h"
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#ifdef Q_OS_LINUX
QApplication app(argc, argv);
#else
QGuiApplication app(argc, argv);
#endif
qmlRegisterType<Worker>("comp.xcicutter", 1, 0, "Worker");
qmlRegisterType<XCIFile>();
QFontDatabase::addApplicationFont(":/fonts/DejaVuSans.ttf");
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
Worker wrk(engine.rootObjects().at(0));
engine.rootContext()->setContextProperty("worker", &wrk);
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}