Skip to content

Conversation

@hebasto
Copy link
Member

@hebasto hebasto commented Dec 26, 2018

@HashUnlimited
Copy link
Contributor

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).

@jonasschnelli
Copy link
Contributor

Thanks for the fix...
But isn't it possible to add a QLayout and have the dialogue autoresize like other windows?
However, this seems to work as well.

Copy link
Contributor

@donaloconnor donaloconnor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 1f7ac92

@hebasto
Copy link
Member Author

hebasto commented Jan 1, 2019

@jonasschnelli Thank you for your review.

But isn't it possible to add a QLayout and have the dialogue autoresize like other windows?

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 QLayout are ignored on resize event on Linux.
Is it better to make 3-lines-of-code workaround and just wait when buggy QProgressDialog get fixed by Qt?

@jonasschnelli
Copy link
Contributor

utACK 1f7ac92cf88ff7e6b10aaa49e174805a5823bfa2

Copy link
Contributor

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
}

Copy link
Member Author

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.

@hebasto hebasto force-pushed the 20181226-fix-macos-qprogressdialog branch from 1f7ac92 to ce89a5c Compare January 5, 2019 10:18
@hebasto
Copy link
Member Author

hebasto commented Jan 5, 2019

@promag your comment has been addressed.

Also a little of obvious code styling added.

Copy link
Member Author

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.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 9, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

No conflicts as of last run.

@hebasto hebasto force-pushed the 20181226-fix-macos-qprogressdialog branch from ce89a5c to 2b06881 Compare January 14, 2019 17:25
@hebasto
Copy link
Member Author

hebasto commented Jan 14, 2019

Rebased.

@promag would you mind re-reviewing?

Copy link
Contributor

@promag promag left a 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.

Copy link
Contributor

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");

Copy link
Contributor

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.

@hebasto hebasto force-pushed the 20181226-fix-macos-qprogressdialog branch from 2b06881 to 7c572c4 Compare January 14, 2019 23:28
@hebasto
Copy link
Member Author

hebasto commented Jan 14, 2019

@promag all nits are fixed.

@hebasto
Copy link
Member Author

hebasto commented Jan 17, 2019

@Sjors would you mind reviewing this PR?

@Sjors
Copy link
Member

Sjors commented Jan 17, 2019

tACK 7c572c4 on macOS 10.14.2

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 7c572c4.

@jonasschnelli
Copy link
Contributor

Tested ACK 7c572c4

@jonasschnelli jonasschnelli merged commit 7c572c4 into bitcoin:master Jan 17, 2019
jonasschnelli added a commit that referenced this pull request Jan 17, 2019
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:
  ![screenshot from 2018-12-26 22-01-30](https://user-images.githubusercontent.com/32963518/50456571-1aa35b80-095e-11e9-8442-c285555f2bee.png)

Tree-SHA512: dde668dfa7d2144973c0e868aea7fdb7d90f78584836d024ffefb8df4a709d6842fa3601954759b4462856a80e81df15b861ea39506599230a16928b621d9f8f
@hebasto hebasto deleted the 20181226-fix-macos-qprogressdialog branch January 17, 2019 21:43
@Sjors
Copy link
Member

Sjors commented Jan 18, 2019

@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.

deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jul 16, 2020
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
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request Aug 24, 2021
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:
  ![screenshot from 2018-12-26 22-01-30](https://user-images.githubusercontent.com/32963518/50456571-1aa35b80-095e-11e9-8442-c285555f2bee.png)

Tree-SHA512: dde668dfa7d2144973c0e868aea7fdb7d90f78584836d024ffefb8df4a709d6842fa3601954759b4462856a80e81df15b861ea39506599230a16928b621d9f8f
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Aug 24, 2021
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:
  ![screenshot from 2018-12-26 22-01-30](https://user-images.githubusercontent.com/32963518/50456571-1aa35b80-095e-11e9-8442-c285555f2bee.png)

Tree-SHA512: dde668dfa7d2144973c0e868aea7fdb7d90f78584836d024ffefb8df4a709d6842fa3601954759b4462856a80e81df15b861ea39506599230a16928b621d9f8f
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GUI] progress window size

8 participants