Forcing the Qt GUI to update before entering a separate function

You shuld be able to process the event queue before entering your code if you;

#include <QApplication>

and, when you want to refresh your GUI, call;

qApp->processEvents();

Note that it may be a good idea to let your long running process call that function now and then, to make your GUI feel more responsive.


If you don't care about your GUI being responsive during this time, then a call to my_label->repaint() would do the trick. Qt can't do anything automatically for you unless you yield to the event loop.

For maximimum responsiveness you might consider running your process in a separate thread and use signal/slot connections (which are thread-safe by default) to signal to your main GUI thread when your processing is complete.