Unsolved SplashScreen implementation question
-
Hello,
I have an embedded Qt application for Linux which has the following startup code:
int main(int argc, char *argv[])
{QApplication app(argc, argv); // Startup actions neeeded to display AppView correctly // Black screen is shown for several seconds // ... QQuickView AppView; AppView.setSource(QUrl(QStringLiteral("main.qml"))); AppView.resize(480, 800); AppView.show(); return app.exec();
}
I'd like to remove the black screen shown before AppView and to display QML animation
instead of it.I see two possible options here but non of them is clear. Could you please advice
which one of them is more correct and also comment/answer the questions in each.- To display QSplashScreen at the beginnning of main().
int main(int argc, char *argv[])
{QApplication app(argc, argv); QSplashScreen *splash = new QSplashScreen(); splash->show(); // Startup actions neeeded to display AppView correctly // Black screen is shown for several seconds // ...
}
The question here is what API to use to attach QML animation to QSplashScreen?
QSplashScreen inherits from QWidget, and so as I understand, no API like QQuickWidget::setSource() can be used.- To display another QQuickView at the beginnning of main() with attached QML animation.
int main(int argc, char *argv[])
{QApplication app(argc, argv); QQuickView SplashView; SplashView.setSource(QUrl(QStringLiteral("SplashScreen.qml"))); SplashView.resize(480, 800); SplashView.show(); app.exec(); // Startup actions neeeded to display AppView correctly // Black screen is shown for several seconds // ... QQuickView AppView; AppView.setSource(QUrl(QStringLiteral("main.qml"))); AppView.resize(480, 800); AppView.show();
}
The question here is how to to close the SplashView and to display AppView on top of it?
Thanks
-
-
@raven-worx Thank you, will try this approach.