Unsolved qprogessbar question!!!
-
If you set Text setformat in qprogressbar and raise % to setvalue, the text begins to appear after 50%.
d->ui->progressScan->setFormat("set format");
d->ui->progressScan->setValue(progressTimer().linePercent()); //percent valueIt is working as timer and is being updated normally. That's the only problem.
answer please.!!!
-
@ds3216 I can't answer as I don't understand your description.
Please explain better and show your real code. -
@ds3216
No reason why this should be so. Check your min & max values. Check whatprogressTimer().linePercent()
is actually returning. Create a standalone minimal reproducer. State what version of Qt and what platform you are using. -
@ds3216 said in qprogessbar question!!!:
is being updated normally
What do you mean by that? The most common approach I know, is to do some work inside a loop and call setValue() on the QProgressBar. Usually, that loop is inside the main thread which also happens to be the GUI thread. This basically prevents the event loop from handling the update of the progress bar. The easiest way to test this is to put
QApplication::processEvents()
right after callingsetValue()
(orsetFormat()
). This is not the best solution and will heavily slow down your application. So, don't leave it inside your code. Once you confirm that this is the problem, we can help out with a better solution. In that case we would need more context how and when you are callingsetValue()
.