I'm making an app on QT with UI. Also, I have a function. I want to display the running time of a function. I also want to pause the stopwatch. Any ideas on how to properly embed a stopwatch in my application? Here is my code:
void SomeFunc()
{
while (1)
{
// Start Timer
// some code
// Stop Timer
// Start Timer2
// some code
// Stop Timer2
}
}
on_push_button()
{
auto futureWatcher = new QFutureWatcher<void>(this);
QObject::connect(futureWatcher, &QFutureWatcher<void>::finished, futureWatcher, &QFutureWatcher<void>::deleteLater);
auto future = QtConcurrent::run( [=]{ PackBytes( file_path, file_name, isProgressBar); });
futureWatcher->setFuture(future);
}