-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
29 lines (21 loc) · 835 Bytes
/
Copy pathmain.cpp
File metadata and controls
29 lines (21 loc) · 835 Bytes
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
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QDir>
#include <QQmlContext>
#include "app/ThemeManager.h"
using namespace Qt::StringLiterals;
int main(int argc, char *argv[]) {
QGuiApplication app(argc, argv);
QGuiApplication::setOrganizationName("k1tbyte");
QGuiApplication::setApplicationName("QML Components demo");
QQmlApplicationEngine engine;
auto* themeManager = new ThemeManager(&app);
engine.rootContext()->setContextProperty("themeManager", themeManager);
const QString executableName = QFileInfo(QCoreApplication::applicationFilePath()).baseName();
const QString qmlPath = QString("qrc:/qt/qml/%1/ui/view/Main.qml").arg(executableName);
engine.load(QUrl(qmlPath));
if (engine.rootObjects().isEmpty()) {
return -1;
}
return app.exec();
}