File tree Expand file tree Collapse file tree 4 files changed +32
-23
lines changed Expand file tree Collapse file tree 4 files changed +32
-23
lines changed Original file line number Diff line number Diff line change @@ -1237,25 +1237,21 @@ void BitcoinGUI::detectShutdown()
12371237
12381238void BitcoinGUI::showProgress (const QString &title, int nProgress)
12391239{
1240- if (nProgress == 0 )
1241- {
1242- progressDialog = new QProgressDialog (title, " " , 0 , 100 );
1240+ if (nProgress == 0 ) {
1241+ progressDialog = new QProgressDialog (title, QString (), 0 , 100 );
1242+ GUIUtil::PolishProgressDialog (progressDialog );
12431243 progressDialog->setWindowModality (Qt::ApplicationModal);
12441244 progressDialog->setMinimumDuration (0 );
1245- progressDialog->setCancelButton (nullptr );
12461245 progressDialog->setAutoClose (false );
12471246 progressDialog->setValue (0 );
1248- }
1249- else if (nProgress == 100 )
1250- {
1251- if (progressDialog)
1252- {
1247+ } else if (nProgress == 100 ) {
1248+ if (progressDialog) {
12531249 progressDialog->close ();
12541250 progressDialog->deleteLater ();
12551251 }
1256- }
1257- else if (progressDialog)
1252+ } else if (progressDialog) {
12581253 progressDialog->setValue (nProgress);
1254+ }
12591255}
12601256
12611257void BitcoinGUI::setTrayIconVisible (bool fHideTrayIcon )
Original file line number Diff line number Diff line change 4848#include < QFileDialog>
4949#include < QFont>
5050#include < QFontDatabase>
51+ #include < QFontMetrics>
5152#include < QKeyEvent>
5253#include < QLineEdit>
54+ #include < QMouseEvent>
55+ #include < QProgressDialog>
5356#include < QSettings>
5457#include < QTextDocument> // for Qt::mightBeRichText
5558#include < QThread>
5659#include < QUrlQuery>
57- #include < QMouseEvent>
5860
5961#if defined(Q_OS_MAC)
6062#pragma GCC diagnostic push
@@ -933,4 +935,16 @@ bool ItemDelegate::eventFilter(QObject *object, QEvent *event)
933935 return QItemDelegate::eventFilter (object, event);
934936}
935937
938+ void PolishProgressDialog (QProgressDialog* dialog)
939+ {
940+ #ifdef Q_OS_MAC
941+ // Workaround for macOS-only Qt bug; see: QTBUG-65750, QTBUG-70357.
942+ const int margin = dialog->fontMetrics ().width (" X" );
943+ dialog->resize (dialog->width () + 2 * margin, dialog->height ());
944+ dialog->show ();
945+ #else
946+ Q_UNUSED (dialog);
947+ #endif
948+ }
949+
936950} // namespace GUIUtil
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ class QAbstractItemView;
3131class QDateTime ;
3232class QFont ;
3333class QLineEdit ;
34+ class QProgressDialog ;
3435class QUrl ;
3536class QWidget ;
3637QT_END_NAMESPACE
@@ -248,6 +249,9 @@ namespace GUIUtil
248249 private:
249250 bool eventFilter (QObject *object, QEvent *event);
250251 };
252+
253+ // Fix known bugs in QProgressDialog class.
254+ void PolishProgressDialog (QProgressDialog* dialog);
251255} // namespace GUIUtil
252256
253257#endif // BITCOIN_QT_GUIUTIL_H
Original file line number Diff line number Diff line change @@ -305,24 +305,19 @@ void WalletView::usedReceivingAddresses()
305305
306306void WalletView::showProgress (const QString &title, int nProgress)
307307{
308- if (nProgress == 0 )
309- {
310- progressDialog = new QProgressDialog (title, " " , 0 , 100 );
308+ if (nProgress == 0 ) {
309+ progressDialog = new QProgressDialog (title, tr ( " Cancel " ), 0 , 100 );
310+ GUIUtil::PolishProgressDialog (progressDialog );
311311 progressDialog->setWindowModality (Qt::ApplicationModal);
312312 progressDialog->setMinimumDuration (0 );
313313 progressDialog->setAutoClose (false );
314314 progressDialog->setValue (0 );
315- progressDialog->setCancelButtonText (tr (" Cancel" ));
316- }
317- else if (nProgress == 100 )
318- {
319- if (progressDialog)
320- {
315+ } else if (nProgress == 100 ) {
316+ if (progressDialog) {
321317 progressDialog->close ();
322318 progressDialog->deleteLater ();
323319 }
324- }
325- else if (progressDialog) {
320+ } else if (progressDialog) {
326321 if (progressDialog->wasCanceled ()) {
327322 getWalletModel ()->wallet ().abortRescan ();
328323 } else {
You can’t perform that action at this time.
0 commit comments