Hi,
I found an issue with the following code:
MyApplication::MyApplication(int& _argc, char** _argv):
QGuiApplication(_argc, _argv)
{
QQmlApplicationEngine *engine = new QQmlApplicationEngine(
QUrl("qrc:/my.qml"),
this
);
connect(
engine, &QQmlApplicationEngine :: quit,
this, &QGuiApplication :: quit
);
}
Qt.quit() [qt-project.org] is called in my QML, and I checked QQmlApplicationEngine::quit was effectively emitted, but the application doesn’t quit. I ended up with the following workaround:
connect(
engine, &QQmlApplicationEngine :: quit,
engine, &QQmlApplicationEngine :: deleteLater
);
connect(
engine, &QQmlApplicationEngine :: destroyed,
this, &QGuiApplication :: quit
);
This version is working: QQmlApplicationEngine::quit schedules engine’s deletion which exits the application. It seems QGuiApplication::quit doesn’t work if the application has an alive QQmlApplicationEngine child. Did anybody experience something like that?
↧