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. Qtimer along with QtConcurrent::run
QtWS25 Last Chance

Qtimer along with QtConcurrent::run

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.9k Views
  • 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.
  • D Offline
    D Offline
    drdas
    wrote on last edited by
    #1

    I want to calculate the time taken to run a script in my project. So wat i have done is ,
    1> I have started a timer and binded the same to GUI through signal & slots.
    2> Script execution code is moved to another thread using QtConcurrent::run()
    3> when script execution is completed, stopping the timer.

    But am facing issue with the above logic, After i start the timer it is not updating in the GUI until the QtConcurrent::run is finished. it starts only after QtConcurrent is finished and runs infinitley.

    Can anyone please suggest a logic to achieve this scenario.

    1 Reply Last reply
    0
    • JohanSoloJ Offline
      JohanSoloJ Offline
      JohanSolo
      wrote on last edited by JohanSolo
      #2

      First, AFAIK the QTimer class does not provide a way to measure time in the sense you want. It only ensures you that a given signal is triggered after X milliseconds, i.e. the timeout() signal is emitted only after x ms.

      Second, to measure the run time of a script you could rely on the clock function.

      `They did not know it was impossible, so they did it.'
      -- Mark Twain

      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