-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
32 lines (22 loc) · 853 Bytes
/
Copy pathmain.cpp
File metadata and controls
32 lines (22 loc) · 853 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
30
31
32
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include "Backend.h"
#include <QQmlContext>
#include <qicon.h>
int main(int argc, char *argv[])
{
#if defined(Q_OS_WIN) && QT_VERSION_CHECK(5, 6, 0) <= QT_VERSION && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
QGuiApplication app(argc, argv);
app.setWindowIcon(QIcon(":/qt/qml/password-generator/icon.png"));
QQmlApplicationEngine engine;
Backend backend;
engine.rootContext()->setContextProperty("backend", &backend);
engine.load(QUrl(QStringLiteral("qrc:/qt/qml/password-generator/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
QObject* root = engine.rootObjects().first();
backend.setRoot(root);
return app.exec();
}