diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp index 4e8e245..3add968 100644 --- a/src/widgets/dialogs/qprogressdialog.cpp +++ b/src/widgets/dialogs/qprogressdialog.cpp @@ -65,7 +65,6 @@ public: QProgressDialogPrivate() : label(0), cancel(0), bar(0), shown_once(false), cancellation_flag(false), - setValue_called(false), showTime(defaultShowTime), #ifndef QT_NO_SHORTCUT escapeShortcut(0), @@ -88,7 +87,6 @@ public: QTimer *forceTimer; bool shown_once; bool cancellation_flag; - bool setValue_called; QElapsedTimer starttime; #ifndef QT_NO_CURSOR QCursor parentCursor; @@ -125,8 +123,6 @@ void QProgressDialogPrivate::init(const QString &labelText, const QString &cance } else { q->setCancelButtonText(cancelText); } - starttime.start(); - forceTimer->start(showTime); } void QProgressDialogPrivate::layout() @@ -602,7 +598,6 @@ void QProgressDialog::reset() d->bar->reset(); d->cancellation_flag = false; d->shown_once = false; - d->setValue_called = false; d->forceTimer->stop(); /* @@ -656,7 +651,7 @@ int QProgressDialog::value() const void QProgressDialog::setValue(int progress) { Q_D(QProgressDialog); - if (d->setValue_called && progress == d->bar->value()) + if (progress == d->bar->value()) return; d->bar->setValue(progress); @@ -665,13 +660,11 @@ void QProgressDialog::setValue(int progress) if (isModal()) QApplication::processEvents(); } else { - if ((!d->setValue_called && progress == 0 /* for compat with Qt < 5.4 */) || progress == minimum()) { + if (progress == 0) { d->starttime.start(); d->forceTimer->start(d->showTime); - d->setValue_called = true; return; } else { - d->setValue_called = true; bool need_show; int elapsed = d->starttime.elapsed(); if (elapsed >= d->showTime) { @@ -765,7 +758,7 @@ void QProgressDialog::setMinimumDuration(int ms) { Q_D(QProgressDialog); d->showTime = ms; - if (d->bar->value() == d->bar->minimum()) { + if (d->bar->value() == 0) { d->forceTimer->stop(); d->forceTimer->start(ms); }