Splash screen in QML
Unsolved
QML and Qt Quick
-
Hi Team,
I am new to Qt QML and trying to implement a splash screen in qml. But, I am getting a below error when running in eglfs instance.
I have referred the below code from GIT and it was working good in x86 instance
"EGLFS: OpenGL windows cannot be mixed with others."
Could you please help me in resolving this.
My code looks likemain.qml
Item { Loader { id: mainWindowLoader anchors.fill: parent visible: false source: "qrc:/window.qml" asynchronous: true onLoaded: { item.visible = true; splashScreenLoader.item.visible = false; splashScreenLoader.source = ""; } } Loader { id: splashScreenLoader source: "qrc:/splashscreen.qml" anchors.fill: parent asynchronous: false onLoaded: { mainWindowLoader.active = true; } } }
splashscreen.qml
Window { id: splashScreen modality: Qt.ApplicationModal flags: Qt.SplashScreen width: 1024 height: 600 Rectangle { id: splashRect anchors.fill: parent color: "white" border.width: 1 border.color: "black" Text { id: initializationErrorMessage text: "This is the splash screen" anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top anchors.topMargin: 50 font.bold: true font.pixelSize: 20 color: "black" } } Component.onCompleted: visible = true }
window.qml
ApplicationWindow { id: mainWindow flags: Qt.Window | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowCloseButtonHint width: 1024 height: 600 visible: false title: "Scresh Screen Test" Component.onCompleted: { var timeout = new Date().valueOf() + 3000; while(timeout > new Date().valueOf()) {} } Text { text: "Window ready!" anchors.centerIn: parent font.bold: true font.pixelSize: 20 color: "black" } }
-
@Praveen-Illa
EGLFS can only display a single window. thus your splash screen cannot be also a window.
you must make it an Item and place it above the content of the mainwindow. E.g. as a child of the windows's overlay for example