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. workerscript always recieve the first version of ListModel

workerscript always recieve the first version of ListModel

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 143 Views 2 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.
  • Bilal_KhanB Offline
    Bilal_KhanB Offline
    Bilal_Khan
    wrote on last edited by Bilal_Khan
    #1

    Peculiar behavior: I have set a timer to send a message [model] to workerscript where it would do some work but on model update, changes are not reflected in the workerscript where it only recieves the initial version on every trigger.

    // workerscript
    WorkerScript.onMessage = function (arg) {
        console.log(arg.model.get(0).next)  //it is always the initial value of model
    
    }
    
    // Main.qml
    
    import "model"
    
      DataModel {
            id: dataModel
        }
    
      WorkerScript {
            id: bgScript
            source: "script.js"
        }
      Timer {
            interval: 6000
            running: true
            repeat: true
            onTriggered: {
                console.log(dataModel.get(0).next)   // it is updated here on change
                bgScript.sendMessage({'model': dataModel})
            }
        }
    
    
    1 Reply Last reply
    0

    • Login

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