Answer the question
In order to leave comments, you need to log in
How to make QProgressBar full?
Hello.
I am using QProgressDialog. Inside it has a QProgressBar, which at some point needs to be set to the maximum (fill), to show that the process is completed.
PB = new QProgressDialog(this);
PB->setAutoClose(false);
PB->setWindowModality(Qt::WindowModal);
PB->setMinimum(1);
PB->setMaximum(100);
PB->setValue(100); // прогресс бар становится пустым
// #1
PB->setValue(PB->maximum()); // тоже самое
// #2
PB->setValue(PB->maximum() - 1); // округляется до 99%
// #3
PB->setMaximum(100);
PB->setValue(99.99999f); // округляется до 99%
Answer the question
In order to leave comments, you need to log in
For future applicants: QProgressDialog has an autoReset property ( true by default ) that is responsible for resetting value when it reaches the maximum. To solve the problem, you need to set this property to false :
p_diag = new QProgressDialog(this);
p_diag->setAutoClose(false);
p_diag->setAutoReset(false); // do not reset value
ui->progressBar->setValue(ui->progressBar->maximum());
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question