Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Friends help me, how does it do to execute a qml function from an Item inside a Parallel Thread to not freeze UI? help please
Forum Updated to NodeBB v4.3 + New Features

Friends help me, how does it do to execute a qml function from an Item inside a Parallel Thread to not freeze UI? help please

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 1.3k Views 1 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.
  • Everton FonsecaE Offline
    Everton FonsecaE Offline
    Everton Fonseca
    wrote on last edited by
    #1

    Friends help me, how does it do to execute a qml function from an Item inside a Parallel Thread to not freeze UI?

    example:

    Import QtQuick 2.7

    MyItem {

     Function foo () {
        
         // script
         For (var i = 0; i <1000000; i ++)
         {
             Console.log ( "Number:" + i)
            
         }
     } // end function
    

    } // end MyItem

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi! See WorkerScript QML Type.

      1 Reply Last reply
      2
      • Everton FonsecaE Offline
        Everton FonsecaE Offline
        Everton Fonseca
        wrote on last edited by
        #3

        More in Work Script I can not work with objects within a function. Is there any way for this?

        1 Reply Last reply
        0
        • Everton FonsecaE Offline
          Everton FonsecaE Offline
          Everton Fonseca
          wrote on last edited by
          #4

          More in Work Script I can not work with objects within a function. Is there any way for this?

          MyItem {

          function foo () {

           // script 
          anotherObj.foo()
          

          } // end function

          } // end MyItem

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by A Former User
            #5

            No, more isn't possible because JS is single-threaded by design. These worker scripts (or web workers in other contexts) are more or less just a hackish work-around for that. Keep in mind that JS is meant only for very short / simple code. Executing it is very inefficient, so you should really do all the complicated non-GUI stuff in C++.

            1 Reply Last reply
            2
            • Everton FonsecaE Offline
              Everton FonsecaE Offline
              Everton Fonseca
              wrote on last edited by
              #6

              So how do I call a function from an object without freezing my UI?

              V 1 Reply Last reply
              0
              • Everton FonsecaE Everton Fonseca

                So how do I call a function from an object without freezing my UI?

                V Offline
                V Offline
                vladstelmahovsky
                wrote on last edited by
                #7

                @Everton-Fonseca C++ and QRunnable

                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