mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-27 20:42:33 +02:00
Merge bitcoin-core/gui#343: Improve the GUI responsiveness when progress dialogs are used
4935ac583b
qt: Improve GUI responsiveness (Hennadii Stepanov)75850106ae
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 ACK4935ac583b
. 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 ACK4935ac583b
. jarolrod: ACK4935ac583b
Tree-SHA512: 2ddd74e7fd87894d341d2439dbaa544d031a350f7f57d4c7e9fbba977dc24080fe60fd7a80a542b1647f1de9091d7fd04a36eab695088d4d75fb836548e99b5f
This commit is contained in:
commit
be1c512437
@ -1385,7 +1385,6 @@ void BitcoinGUI::showProgress(const QString &title, int nProgress)
|
||||
progressDialog = new QProgressDialog(title, QString(), 0, 100);
|
||||
GUIUtil::PolishProgressDialog(progressDialog);
|
||||
progressDialog->setWindowModality(Qt::ApplicationModal);
|
||||
progressDialog->setMinimumDuration(0);
|
||||
progressDialog->setAutoClose(false);
|
||||
progressDialog->setValue(0);
|
||||
} else if (nProgress == 100) {
|
||||
|
@ -853,10 +853,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());
|
||||
dialog->show();
|
||||
#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)
|
||||
|
@ -207,6 +207,9 @@ void WalletControllerActivity::showProgressDialog(const QString& label_text)
|
||||
m_progress_dialog->setCancelButton(nullptr);
|
||||
m_progress_dialog->setWindowModality(Qt::ApplicationModal);
|
||||
GUIUtil::PolishProgressDialog(m_progress_dialog);
|
||||
// The setValue call forces QProgressDialog to start the internal duration estimation.
|
||||
// See details in https://bugreports.qt.io/browse/QTBUG-47042.
|
||||
m_progress_dialog->setValue(0);
|
||||
}
|
||||
|
||||
void WalletControllerActivity::destroyProgressDialog()
|
||||
|
@ -331,7 +331,6 @@ void WalletView::showProgress(const QString &title, int nProgress)
|
||||
progressDialog = new QProgressDialog(title, tr("Cancel"), 0, 100);
|
||||
GUIUtil::PolishProgressDialog(progressDialog);
|
||||
progressDialog->setWindowModality(Qt::ApplicationModal);
|
||||
progressDialog->setMinimumDuration(0);
|
||||
progressDialog->setAutoClose(false);
|
||||
progressDialog->setValue(0);
|
||||
} else if (nProgress == 100) {
|
||||
|
Loading…
Reference in New Issue
Block a user