forked from github_mirror/framelesshelper
Minor tweaks.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
d8e07b86c4
commit
083e5ec38c
|
@ -99,16 +99,21 @@ int main(int argc, char *argv[]) {
|
|||
QQmlApplicationEngine engine;
|
||||
qmlRegisterType<FramelessQuickHelper>("wangwenx190.Utils", 1, 0,
|
||||
"FramelessHelper");
|
||||
const QUrl url(QString::fromUtf8("qrc:///qml/main.qml"));
|
||||
QObject::connect(
|
||||
const QUrl mainQmlUrl(QString::fromUtf8("qrc:///qml/main.qml"));
|
||||
const QMetaObject::Connection connection = QObject::connect(
|
||||
&engine, &QQmlApplicationEngine::objectCreated, &application,
|
||||
[&url](QObject *obj, const QUrl &objUrl) {
|
||||
if (!obj && (url == objUrl)) {
|
||||
QCoreApplication::exit(-1);
|
||||
[&mainQmlUrl, &connection](QObject *object, const QUrl &url) {
|
||||
if (url != mainQmlUrl) {
|
||||
return;
|
||||
}
|
||||
if (!object) {
|
||||
QGuiApplication::exit(-1);
|
||||
} else {
|
||||
QObject::disconnect(connection);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
engine.load(url);
|
||||
engine.load(mainQmlUrl);
|
||||
#endif
|
||||
|
||||
return QApplication::exec();
|
||||
|
|
Loading…
Reference in New Issue