Reputation: 71
I try much method i have find to do this, but no one work for me.
I have tried with qApp.processEvents() and with update() but no one work.
void GUI::startLoading(int currentFile) {
ui->progressBar->setValue(currentFile);
ui->progressBar->update();
}
currentFile is an int of the current loaded file from another function.
Here's a screenshot of de dubug that told the current value of the progress bar, but the progress bar don't increment.
Upvotes: 0
Views: 1788
Reputation: 52357
Are you doing busy work in the GUI thread? Qt needs to get a chance to process events for the redraw to happen.
update()
only enqueues the redraw. Note that setValue()
calls update()
itself. To avoid this problem, you can call QEventLoop::processEvents()
from time to time (e.g. at the same place where you update the progress bar), or use a worker thread.
Upvotes: 0