Repository navigation
Improve the GUI responsiveness when progress dialogs are used - #343
Conversation
QProgressDialog shows itself if the estimated time an operation will take is beyond the minimumDuration value. Direct call show() breaks that behavior on macos.
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.
| // The setValue call forces QProgressDialog to start the internal duration estimation. | ||
| // See details in https://bugreports.qt.io/browse/QTBUG-47042. |
There was a problem hiding this comment.
In commit "qt: Improve GUI responsiveness" (4935ac5)
It could be useful to also add this comment other places we're relying on this behavior (or maybe dedup the code more generally):
https://github.com/bitcoin/bitcoin/blob/860093401840d7aad7b439aeba0d1598933bc9c6/src/qt/bitcoingui.cpp#L1380
https://github.com/bitcoin/bitcoin/blob/860093401840d7aad7b439aeba0d1598933bc9c6/src/qt/walletview.cpp#L335
There was a problem hiding this comment.
Thank you for your review.
I agree with you that there is a possibility to dedup the code more generally. As such a change must be refactoring, I intentionally leaved it for a follow up, if there are no objections from you.
A comment added here because this dialog is not actually a "progress" one, it is a busy indicator without meaningful values. But it requires to call setValue(0) to start internal timer.
In other cases calling setValue() is natural, as dialogs are real "progress" ones, and the value shows the progress.
There was a problem hiding this comment.
Right, the progress here is [0,0].
| // 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); |
There was a problem hiding this comment.
From QTBUG-47042:
QProgressDialogis designed to show itself automatically, based on an internal estimate for the duration of the operation and theminimumDurationproperty. You never callshow()orexec()on it manually. You're also not supposed to keep it around when it's not used. In 5.4, the only way to start the internal duration estimation was to callsetValue(0). But we noticed that many people didn't callsetValue(0), but just handed external progress information on to the progress dialog, and whether or not that progress information started at 0 or, say, 1, would determine whether the dialog would show itself at all, or not. This was thought to be a bit fragile, so we changed it so that the start time of the duration estimate was the dialog construction time unlesssetValue(0)(or, more correctly,setValue(minimum())was called, leading to the dialog showing itselfminimumDurationafter its construction, even if it was constructed not for immediate use (which the dialog cannot distinguish from a really long-running operation).
| // The setValue call forces QProgressDialog to start the internal duration estimation. | ||
| // See details in https://bugreports.qt.io/browse/QTBUG-47042. |
There was a problem hiding this comment.
Right, the progress here is [0,0].
…ess dialogs are used 4935ac5 qt: Improve GUI responsiveness (Hennadii Stepanov) 7585010 qt, macos: Fix GUIUtil::PolishProgressDialog bug (Hennadii Stepanov) Pull request description: [`QProgressDialog`](https://doc.qt.io/qt-5/qprogressdialog.html) estimates the time the operation will take (based on time for steps), and only shows itself if that estimate is beyond [`minimumDuration`](https://doc.qt.io/qt-5/qprogressdialog.html#minimumDuration-prop). The default `minimumDuration` value is [4 seconds](https://doc.qt.io/qt-5/qprogressdialog.html#details), and it could make users think that the GUI is frozen. This PR sets `minimumDuration` to zero for all progress dialogs, that affects ones in the `WalletControllerActivity` class. ACKs for top commit: ryanofsky: Code review ACK 4935ac5. I'm not very familiar with this API but all the changes and explanations make sense and are very clear, and this seems like it should be an improvement. promag: Code review ACK 4935ac5. jarolrod: ACK 4935ac5 Tree-SHA512: 2ddd74e7fd87894d341d2439dbaa544d031a350f7f57d4c7e9fbba977dc24080fe60fd7a80a542b1647f1de9091d7fd04a36eab695088d4d75fb836548e99b5f
QProgressDialogestimates the time the operation will take (based on time for steps), and only shows itself if that estimate is beyondminimumDuration.The default
minimumDurationvalue is 4 seconds, and it could make users think that the GUI is frozen.This PR sets
minimumDurationto zero for all progress dialogs, that affects ones in theWalletControllerActivityclass.