Why does my QML application window appear as a separate window (on Windows only)
-
I'm not sure if this is a build question or a Qt Quick question.
My app has a single application window and this behaves as you'd expect when I run it locally from Qt Creator on Windows or Mac (and also on iPad when packaged for iOS and installed via the App Store or TestFlight).
However once it has been packaged, code signed and installed as an app on Windows, its behaviour is different: when I start the app, it shows the splash screen and then instead of the app appearing in the same window, it's appearing in a separate window.
To be clear, I am not creating a splash screen myself or using a class like
QSplashScreen
. As part of packaging a Windows app, you provide an app manifest and associated assets, which contain icons and aSplashScreen.png
image. It's this that's appearing and weirdly remaining separate from my app.Any ideas?
In
Main.qml
my root object isWindow
.In
main.cpp
:#include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine; const QUrl url(u"qrc:/Primary/Main.qml"_qs); QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed, &app, []() { QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url); return app.exec(); }
Notes
- The full test app is on Github: https://github.com/paulmasri/Qt6-CMake-QML
- The app is built in Qt 6.5 with CMake
-
I'm wondering if the answer is related to
Window
propertiesflags
,modality
and possiblyvisibility
. I've read the docs but some of it is a little thin on the ground and I am unclear how these properties interact.Can anyone suggest what's needed for my app to be:
- standard iPad app, which means single window that's fullscreen, and
- single-window app on Windows and MacOS
I've been controlling whether my app is fullscreen by setting
visibility: Window.FullScreen
. I still want to have the option to set this or not set this. (Or a different way to start / go into / out of full screen mode for Windows & MacOS.)