-
Notifications
You must be signed in to change notification settings - Fork 38.6k
qt: Add workaround for QProgressDialog bug on macOS #15040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
qt: Add workaround for QProgressDialog bug on macOS #15040
Conversation
|
As a workaround this seems to work for the specific case, tried with extra long wallet names. Thanks for the links btw, out of curiosity I have also tried to apply the same to a different project where Qt's dialog margins are overruled by style sheets - no effect there (this just for info). |
|
Thanks for the fix... |
donaloconnor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 1f7ac92
|
@jonasschnelli Thank you for your review.
Yes, it is possible to do something like this: QLabel* label = new QLabel(title);
progressDialog->setLabel(label);
QProgressBar* bar = new QProgressBar;
progressDialog->setBar(bar);
QPushButton* cancel_button = new QPushButton(tr("Cancel"));
progressDialog->setCancelButton(cancel_button);
QHBoxLayout* h_layout = new QHBoxLayout;
h_layout->addStretch();
h_layout->addWidget(cancel_button);
QVBoxLayout* v_layout = new QVBoxLayout;
v_layout->addWidget(label);
v_layout->addWidget(bar);
v_layout->addLayout(h_layout);
progressDialog->setLayout(v_layout);But such implementation introduces new issues: e.g., content margins of |
|
utACK 1f7ac92cf88ff7e6b10aaa49e174805a5823bfa2 |
src/qt/bitcoingui.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the implementation to something like:
void GUIUtil::PolishProgressDialog(QProgressDialog* dialog)
{
#ifdef Q_OS_MAC
// Workaround for macOS-only Qt bug; see: QTBUG-65750, QTBUG-70357.
const int margin = (dialog->fontMetrics()).width("X");
progressDialog->resize(dialog->width() + (2 * margin), progressDialog->height());
#else
Q_UNUSED(dialog);
#endif
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @promag. Will do.
1f7ac92 to
ce89a5c
Compare
|
@promag your comment has been addressed. Also a little of obvious code styling added. |
src/qt/bitcoingui.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for reviewers. QProgressDialog::QProgressDialog() docs:
If QString() is passed then no cancel button is shown.
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
ce89a5c to
2b06881
Compare
|
Rebased. @promag would you mind re-reviewing? |
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 2b06881, just 2 minor nits.
src/qt/guiutil.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit const int margin = dialog->fontMetrics().width("X");
src/qt/guiutil.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, dialog->width() + 2 * margin.
See: QTBUG-65750, QTBUG-70357.
2b06881 to
7c572c4
Compare
|
@promag all nits are fixed. |
|
@Sjors would you mind reviewing this PR? |
|
tACK 7c572c4 on macOS 10.14.2 |
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 7c572c4.
|
Tested ACK 7c572c4 |
7c572c4 Add workaround for QProgressDialog bug on macOS (Hennadii Stepanov) Pull request description: Fix #15016. Refs: - [QTBUG-65750: QProgressDialog too small width at larger font size on Mac](https://bugreports.qt.io/browse/QTBUG-65750) - [QTBUG-70357: QProgressDialog is too narrow to fit the text of its label](https://bugreports.qt.io/browse/QTBUG-70357) With this PR:  Tree-SHA512: dde668dfa7d2144973c0e868aea7fdb7d90f78584836d024ffefb8df4a709d6842fa3601954759b4462856a80e81df15b861ea39506599230a16928b621d9f8f
|
@HashUnlimited that's probably too much OS-specific customisation. I don't think the benefits of that feature would outweigh the cost of maintaining it. Feel free to make a Github issue with that feature suggestion if you feel strongly about it though. |
Summary: See: QTBUG-65750, QTBUG-70357. --- Backport of Core [[bitcoin/bitcoin#15040 | PR15040]] This apparently reapplies a nit fixed in D2144. I've chosen to stay close to the Core version for less merge headaches. Test Plan: unfortunately I do not have a macOS in hand to test this Reviewers: #bitcoin_abc, jasonbcox Reviewed By: #bitcoin_abc, jasonbcox Differential Revision: https://reviews.bitcoinabc.org/D6957
7c572c4 Add workaround for QProgressDialog bug on macOS (Hennadii Stepanov) Pull request description: Fix bitcoin#15016. Refs: - [QTBUG-65750: QProgressDialog too small width at larger font size on Mac](https://bugreports.qt.io/browse/QTBUG-65750) - [QTBUG-70357: QProgressDialog is too narrow to fit the text of its label](https://bugreports.qt.io/browse/QTBUG-70357) With this PR:  Tree-SHA512: dde668dfa7d2144973c0e868aea7fdb7d90f78584836d024ffefb8df4a709d6842fa3601954759b4462856a80e81df15b861ea39506599230a16928b621d9f8f
7c572c4 Add workaround for QProgressDialog bug on macOS (Hennadii Stepanov) Pull request description: Fix bitcoin#15016. Refs: - [QTBUG-65750: QProgressDialog too small width at larger font size on Mac](https://bugreports.qt.io/browse/QTBUG-65750) - [QTBUG-70357: QProgressDialog is too narrow to fit the text of its label](https://bugreports.qt.io/browse/QTBUG-70357) With this PR:  Tree-SHA512: dde668dfa7d2144973c0e868aea7fdb7d90f78584836d024ffefb8df4a709d6842fa3601954759b4462856a80e81df15b861ea39506599230a16928b621d9f8f
Fix #15016.
Refs:
With this PR:
