forked from stephenquan/DocumentDialogApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (29 loc) · 1.24 KB
/
Copy pathmain.cpp
File metadata and controls
34 lines (29 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
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include "DocumentDialog.h"
#include "EnumInfo.h"
#include "FileInfo.h"
#include "FileFolder.h"
#include "AppFramework.h"
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setOrganizationName("StephenQuan");
QCoreApplication::setOrganizationDomain("Stephen.Quan");
QCoreApplication::setApplicationName("DocumentDialogApp");
QGuiApplication app(argc, argv);
qmlRegisterType<DocumentDialog>("StephenQuan", 1, 0, "DocumentDialog");
qmlRegisterType<EnumInfo>("StephenQuan", 1, 0, "EnumInfo");
qmlRegisterType<FileInfo>("StephenQuan", 1, 0, "FileInfo");
qmlRegisterType<FileFolder>("StephenQuan", 1, 0, "FileFolder");
qmlRegisterSingletonType<AppFramework>("StephenQuan", 1, 0, "AppFramework", AppFramework::singletonProvider);
QQmlApplicationEngine engine;
const QUrl url(QStringLiteral("qrc:/qml/main.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
engine.load(url);
return app.exec();
}