0

I am developing a user interface with qt/QML and I need to show a splashscreen image at the begininning of the application. I'm running the application on a device with a iMX6 microprocessor. I used the library QtSplashscreen but it gives me this error: EGLFS: openGL windows cannot be mixed with others.

I know that it cannot open 2 windows simultaneously, can somebody help?

sebba23
  • 544
  • 7
  • 24

1 Answers1

0

About your problem, see this question:

OpenGL and Qt Quick 2 applications can only have one fullscreen window existing at a time. Trying to create another OpenGL window, or trying to mix an OpenGL window with a raster one will display the above message and abort the application.

QSplashScreen use another window to show the splash view. So, this is not a direct solution. You can embed your QWidget inside a QQuickItem to use it as QtQuick2 control components.

Another, and faster solution is to use a QML component and load it with a Loader. You can take a look in the Qt Examples Repository, this file is a good example.

Here we go with an easy example;

Loader {
    id: splashLoader
    anchors.fill: parent
    source: "SplashScreen.qml"
    asynchronous: false
    visible: true

    onStatusChanged: {
        if (status === Loader.Ready) {
            appLoader.setSource("App.qml");
        }
    }
}

Connections {
    target: splashLoader.item
    onReadyToGo: {
        appLoader.visible = true
        appLoader.item.init()
        splashLoader.visible = false
        splashLoader.setSource("")
        appLoader.item.forceActiveFocus();
    }
}

Loader {
    id: appLoader
    anchors.fill: parent
    visible: false
    asynchronous: true
    onStatusChanged: {
        if (status === Loader.Ready)
            splashLoader.item.appReady()
        if (status === Loader.Error)
            splashLoader.item.errorInLoadingApp();
    }
}
mohabouje
  • 3,867
  • 2
  • 14
  • 28