I have QMainWindow
which embed a QQuickWidget
.
The QQuickWidget
display two differents qml (splash.qml
and main.qml
) according to the state of the app (initialized or not).
I want my window to be in splashScreen mode when the splash.qml
is displayed, so I did :
MainWindow::MainWindow(QMainWindow * parent) :QMainWindow(parent)
{
QApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
mDefaultFlags = windowFlags();
setAttribute(Qt::WA_DeleteOnClose, true);
setWindowFlags(Qt::SplashScreen);
mQuickWidget = new QQuickWidget(this);
//...
setCentralWidget(mQuickWidget);
mQuickWidget->show();
}
The QML trigger a slot when the init is done and the other qml file is loaded. I then reset the flags to their default value to go back from splashscreen :
void MainWindow::UpdateWindowAfterInit()
{
setWindowFlags(mDefaultFlags);
show();
}
Everything goes as expected , but when I try to close my app it never reach the end of the main()
whereas it close nicely if i don't apply the Qt::SplashScreen
flag.
What should I do to be able to close my app ?