Planned maintenance: From Sunday 8th December 10:00 CET there will be changes to try and solve the caching issues that have been experienced. If anyone has a problem connecting after this period then please PM @AndyS or any of the moderators.

QML Timer and Loader



  • Qt5.7.0, QtQuick2.0, simple QML page with a Loader:

    Item {
    
        Loader { 
            id: pageLoader 
            asynchronous: true
        }
    
        Component.onCompleted {
            pageLoader.source = "Page1.qml"
        }
    }
    

    Page1.qml contains a Timer:

    Timer {
            interval: 1000
            repeat: true
            running: true
            triggeredOnStart: true
            onTriggered: console.debug(".")
        }
    

    But when I load the page inside the Loader the Timer won't fire.
    What am I missing here?



  • Hi! I'm not 100% sure but I think the problem is that, using an asynchronous Loader, the Timer is created and started on a different thread but this thread has no event loop.


  • Moderators

    @Mark81 The example works. Is there anything else that is missing ?