| 945 | } |
| 946 | |
| 947 | void PolishProgressDialog(QProgressDialog* dialog) |
| 948 | { |
| 949 | #ifdef Q_OS_MAC |
| 950 | // Workaround for macOS-only Qt bug; see: QTBUG-65750, QTBUG-70357. |
| 951 | const int margin = TextWidth(dialog->fontMetrics(), ("X")); |
| 952 | dialog->resize(dialog->width() + 2 * margin, dialog->height()); |
| 953 | #endif |
| 954 | // QProgressDialog estimates the time the operation will take (based on time |
| 955 | // for steps), and only shows itself if that estimate is beyond minimumDuration. |
| 956 | // The default minimumDuration value is 4 seconds, and it could make users |
| 957 | // think that the GUI is frozen. |
| 958 | dialog->setMinimumDuration(0); |
| 959 | } |
| 960 | |
| 961 | int TextWidth(const QFontMetrics& fm, const QString& text) |
| 962 | { |
no test coverage detected