Refresh / update GUI while the slot is running

All attributes of GUI elements (text, elements ...) are updated after the slot is finished, and I have a small label that displays the application status (for example, "Update", "Settings ...", "Scan ...", " Done ", etc.) During startup.

How can I set the label text to something like "Refreshing ..." right after the slot has been started, and when the slot is almost done, change the label text to something like "Done"?

I'm currently doing this, releasing

ui->Status->setText("Refreshing ..."); ... ui->Status->setText("Done"); 

inside the slot, but the change is visible only after the slot is made, so I never see "Update ...".

Sorry if this is something simple, but I'm new to OOP and I keep thinking in a consistent way.

+2
qt
source share
1 answer

Here is what I did then. "qApp-> processEvents ();" was the key. Refaint () is not enough.

 void Widget::SetStatus(QString status) { ui->Status->setText(status); ui->Status->repaint(); qApp->processEvents(); } 
+1
source share

All Articles