Window blacked out (not responding) even while updating status constantly
Hi,
I am updating the status of a worker thread in GUI using the following code:
Code:
while(!grabber->bGrabberFinished)
{
ui->statusBar->showMessage(grabber->status);
ui->label->setText(grabber->status);
ui->label->update();
ui->progressBar->setValue(grabber->progress);
ui->progressBar->update();
boost::this_thread::sleep (boost::posix_time::milliseconds(40));
}
Here, my worker thread updates the grabber object's progress and status (so the grabber object is shared between the GUI thread and the worker thread).
Everything works fine (my GUI is updated at regular intervals), but during this process, Windows blacks out my screen as "not responding" even though the label is updated every 40 milliseconds...
What am I doing wrong?
Thanks,
Chytu.
Re: Window blacked out (not responding) even while updating status constantly
Re: Window blacked out (not responding) even while updating status constantly
Thank you very much for the link. Din't know about the timer.
Using timer timeout() to convert the busy wait (or the sleep command) into a signal-slot thingy solved the problem...