When you "sleep()" you are blocking the thread, it can't do any of the operations you are asking it to perform.
You need to allow the Qt event loop to process events.
One option is to use a nested event loop
connect(nr, SIGNAL(finished()), &loop, SLOT(quit())); // or the equivalent function pointer based syntax
loop.exec();
QEventLoop loop;
connect(nr, SIGNAL(finished()), &loop, SLOT(quit())); // or the equivalent function pointer based syntax
loop.exec();
To copy to clipboard, switch view to plain text mode
Bookmarks