Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to notify something outside if the module is loaded by loader



  • Hi all

    I want to check param from one module loaded by loader when it's active.

    For example, I want to show a window loaded by loader after the splash finished(visible: false)

    QtObject {
        id: root
    
        property QtObject splashScreen: Splash{
            id: splash
        }
    
        property var loader: Loader{
            source: "qrc:/MainWIndow.qml"
            asynchronous: true
            active: false
        }
    
        Component.onCompleted:{
            splashScreen.delay();
            loader.active = true;
            while(!splashScreen.visible)
                loader.show()
        }
    }
    

    Also, I want to communicate between Splash and Mainwindow, what should I do?

    Regards
    Mihan



  • Put Splash inside MainWindow.qml and have that file control when the Splash is shown.
    Add property to MainWindow.qml.

    You could do this in one file:

    Component {
      id: customMainWindow
      MainWindow {
        loader: true  // add this property to MainWindow
        Splash {
        }
        // add custom splash logic as needed
      }
    }
    
    Loader {
      sourceComponent: customMainWindow
    }
    

Log in to reply