Fix problem that could cause CProgressBar to hang and not close

This commit is contained in:
Seeker4 2019-08-23 11:40:52 -07:00
parent a8dc05c3f5
commit 36acc7bd2f

View File

@ -55,6 +55,9 @@ void CProgressBar::add (long count) {
// See if timer limit has passed // See if timer limit has passed
if (!progress && !timeChecked && (timer.elapsed() > timerLimit)) { if (!progress && !timeChecked && (timer.elapsed() > timerLimit)) {
maxSteps -= numDone; // maxSteps now is number of steps remaining
numDone = 1; // and we figure only one processed so far
progress = new QProgressDialog(savedTitle, progress = new QProgressDialog(savedTitle,
QString(), 0, maxSteps, parent, QString(), 0, maxSteps, parent,
Qt::WindowSystemMenuHint | Qt::WindowTitleHint); Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
@ -62,8 +65,7 @@ void CProgressBar::add (long count) {
progress->setValue(0); progress->setValue(0);
progress->setMinimumWidth(width); progress->setMinimumWidth(width);
progress->show(); progress->show();
maxSteps -= numDone; // maxSteps now is number of steps remaining
numDone = 1; // and we figure only one processed so far
QCoreApplication::processEvents(); QCoreApplication::processEvents();
showProgress = true; showProgress = true;
} }