QML Thread module



  • I have developed a module that supports parallel threads in qml, supports object orientation with Item {}, ready for sharing and simple to use, and really very powerful for qml threads.

    //example
    import m7.Threads 1.0

    Thread{

    id: thread
    runnable: "qrc:Runnable.qml"
    threadMap: ThreadMap // map datas
                        {
                          itens: { 'a':1,'b':2 }
                        }
       
    onStarted:{
    
     console.log("Begin process")
    

    }

    //Slot 
    onFromRun:{
    
        var total =  sum
        console.log(total)
          
     }
    

    onFinished:{

      // Runnable is dead
      console.log("End process")
    

    }

     Component.onCompleted: start()
    

    }

    //File Runnable.qml

    import m7.Threads 1.0

    Runnable{

    function run(){

      var sum = a + b
      
       //send to Thread parent signal to slot onFromRun
       toThread({'sum': sum}) 
    

    }

    }


  • Moderators

    Great! Thank you for sharing. Can you post a link to the source code?



  • @Wieland Of course, soon I will pass the link of git to be able to download with the documentation of the module = D


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.