qt: Improve GUI responsiveness

QProgressDialog estimates the time the operation will take (based on
time for steps), and only shows itself if that estimate is beyond
minimumDuration. The default minimumDuration value is 4 seconds, and it
could make users think that the GUI is frozen.
This commit is contained in:
Hennadii Stepanov
2021-05-22 21:32:51 +03:00
parent 75850106ae
commit 4935ac583b
4 changed files with 8 additions and 4 deletions

View File

@@ -818,9 +818,12 @@ void PolishProgressDialog(QProgressDialog* dialog)
// Workaround for macOS-only Qt bug; see: QTBUG-65750, QTBUG-70357.
const int margin = TextWidth(dialog->fontMetrics(), ("X"));
dialog->resize(dialog->width() + 2 * margin, dialog->height());
#else
Q_UNUSED(dialog);
#endif
// QProgressDialog estimates the time the operation will take (based on time
// for steps), and only shows itself if that estimate is beyond minimumDuration.
// The default minimumDuration value is 4 seconds, and it could make users
// think that the GUI is frozen.
dialog->setMinimumDuration(0);
}
int TextWidth(const QFontMetrics& fm, const QString& text)