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