-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
33 lines (31 loc) · 1.09 KB
/
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
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QProcess>
#include "message_handler.h"
int main(int argc, char *argv[])
{
qInstallMessageHandler(messageHandler);
QGuiApplication app(argc, argv);
app.setOrganizationName("Junbaibai");
app.setOrganizationDomain("Junbaibai");
app.setApplicationName("hoisavegames");
QObject::connect(&app, &QGuiApplication::aboutToQuit, &app, [ = ]() {
qDebug() << 1111;
for (QObject *obj : QCoreApplication::instance()->children()) {
if("QProcess" == QString(obj->metaObject()->className())) {
QProcess * process = (QProcess*)obj;
qInfo() << "wait for un finished process";
process->waitForFinished();
}
};
});
QQmlApplicationEngine engine;
const QUrl url(u"qrc:/hoisavegames/Main.qml"_qs);
QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
&app, []() {
QCoreApplication::exit(-1);
},
Qt::QueuedConnection);
engine.load(url);
return app.exec();
}