Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Timer and Loader
Forum Updated to NodeBB v4.3 + New Features

QML Timer and Loader

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
timerloadercomponentqml
3 Posts 3 Posters 1.9k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mark81
    wrote on 5 Oct 2016, 14:19 last edited by
    #1

    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?

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on 5 Oct 2016, 16:30 last edited by
      #2

      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.

      1 Reply Last reply
      1
      • P Offline
        P Offline
        p3c0
        Moderators
        wrote on 6 Oct 2016, 07:00 last edited by
        #3

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

        157

        1 Reply Last reply
        1

        2/3

        5 Oct 2016, 16:30

        • Login

        • Login or register to search.
        2 out of 3
        • First post
          2/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved