There are few aproaches. One of them is using QTimer to queue your process right after QDialog event loop start:
QTimer::singleShot(0, this, SLOT(performUpdate());
dlg.exec();
Important thing from Qt docs:
A QTimer with a timeout interval of 0 will time out as soon as all the events in the window system's event queue have been processed.
So what happens here? We're scheduling slot performUpdate()
to be executed as soon as control is back to event loop. When calling dlg.exec()
you're starting new event loop. So your dialog will be shown first (as it is window system event) and then when everything get processed your slot will be executed.
Worth to mention is that when you're performing blocking slot, you should call QApplication::processEvents() from time to time to get ui updated.