Reputation: 38275
My Qt 4 application can only update the log box area (actually the whole GUI) until a function finishes execution. Is there any way to update the GUI/log box during the execution? Like adding something like QWidget::repaint()
or QWidget::update()
in the for loop, so the user can see that the GUI is processing, rather than wait until the function finishes and print out the log at once.
Upvotes: 1
Views: 453
Reputation: 5827
You need to occasionally call QCoreApplication::processEvents()
during the execution of your function. This will keep the GUI alive and responsive by letting the event loop run.
An alternative is to execute your function in a separate thread. More information on threads in Qt can be found here: http://qt-project.org/doc/qt-4.8/threads.html.
Upvotes: 2