-
Notifications
You must be signed in to change notification settings - Fork 37.7k
qt: Fix height of QR-less ReceiveRequestDialog #17597
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: Fix height of QR-less ReceiveRequestDialog #17597
Conversation
Right, but #17597 (comment) |
Wasn't there some other way to pack the window? |
Qt allows many ways to do it. I've chosen one with the minimal diff, though. |
We use hardcoded sizes as defaults/minimums/maximums for all windows now.
Currently, we rely on window resizing. This PR changes default/minimum heights and the dialog always could be resized automagically, if QR image is supplied, or manually. |
The problem is that these values can be tweaked until eternity, no two people with different OS / configuration are going to arrive at exactly the same value. |
Haven't tested it yet but I think just a |
@emilengler
IMO, QWidget::adjustSize() should not be used to fix a broken layout. It first was introduced in our repo in #16971, but I agree with @promag's #16971 (comment) and @Sjors's #16971 (comment). |
78c6606
to
56c2d01
Compare
@laanwj @jonasschnelli @emilengler
Yes, alternative
All number in |
56c2d01
to
04df22e
Compare
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
04df22e
to
23138de
Compare
It seems Travis is happy now. |
@practicalswift w.r.t. #17658 (comment) would mind reviewing this PR? |
23138de
to
cc88011
Compare
@Sjors
Fixed; also it made diffs smaller ;) Screenshots in OP have been updated. |
Much better. ACK cc88011 |
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.
Can you split the bugfix (height) from the controversial/problematic changes?
</widget> | ||
</item> | ||
<item> | ||
<widget class="QTextEdit" name="outUri"> |
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.
The QTextEdit widget made it more obvious to users they could select...
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.
Since QTextEdit
inherits QAbstractScrollArea
with very loose size policy, it is the point of this PR to get rid of it.
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.
... then Concept NACK I guess
Without QTextEdit, you won't be able to select and copy everything together.
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.
Without QTextEdit, you won't be able to select and copy everything together.
Maybe a new button "Copy ALL" could help?
Also all info, except a wallet name, is encoded in the URI.
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.
Sounds like a hack
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.
There's a copy-URI button which copies the URI. You can tripple click on the URI itself to select it.
The QTextEdit
used to cover all fields. Tripple click in that edit field wouldn't select the URI, but everything, which doesn't seem useful.
<bool>true</bool> | ||
</property> | ||
<property name="textInteractionFlags"> | ||
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> |
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.
Selection by keyboard can be nice...
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.
This is not trivial, unfortunately (see #14810).
@@ -115,7 +280,7 @@ | |||
<item> | |||
<widget class="QDialogButtonBox" name="buttonBox"> | |||
<property name="standardButtons"> | |||
<set>QDialogButtonBox::Close</set> |
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.
Close
seems more correct.
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.
From QDialogButtonBox
docs:
- An "OK" button defined with the
AcceptRole
. - A "Close" button defined with the
RejectRole
.
It seems the AcceptRole
is more appropriate for interaction with this dialog.
Also see @promag's comment.
</font> | ||
</property> | ||
<property name="text"> | ||
<string notr="true">URI:</string> |
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.
This SHOULD be translated...
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.
"URI" is a ubiquitous international abbreviation which does not require any translation, IMO.
Refs:
- https://www.wikipedia.org/ (in different languages)
src/qt/locale/*.ts
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.
What about languages which don't use Latin characters?
eg https://ur.wikipedia.org/wiki/%DB%8C%D9%88_%D8%A2%D8%B1_%D8%A2%D8%A6%DB%8C
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.
What about languages which don't use Latin characters?
qt/locale/bitcoin_ur.ts
does not translate "URI".
My native language does not use Latin characters, and "URI", "HTTP" etc are in use.
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.
Probably best to let translators decide that. I doubt 99.9% of native English speakers even know what URI means.
cc88011
to
b8e90f3
Compare
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.
re-ACK b8e90f3; only changes in the interface file, which I don't have strong feelings about.
</font> | ||
</property> | ||
<property name="text"> | ||
<string notr="true">URI:</string> |
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.
Probably best to let translators decide that. I doubt 99.9% of native English speakers even know what URI means.
</widget> | ||
</item> | ||
<item> | ||
<widget class="QTextEdit" name="outUri"> |
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.
There's a copy-URI button which copies the URI. You can tripple click on the URI itself to select it.
The QTextEdit
used to cover all fields. Tripple click in that edit field wouldn't select the URI, but everything, which doesn't seem useful.
It works, but the following also works --- a/src/qt/forms/receiverequestdialog.ui
+++ b/src/qt/forms/receiverequestdialog.ui
@@ -6,8 +6,6 @@
<rect>
<x>0</x>
<y>0</y>
- <width>487</width>
- <height>597</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp
index b4fae7d78d..cfe0bc7d52 100644
--- a/src/qt/receiverequestdialog.cpp
+++ b/src/qt/receiverequestdialog.cpp
@@ -85,6 +85,7 @@ void ReceiveRequestDialog::update()
if (ui->lblQRCode->setQR(uri, info.address)) {
ui->btnSaveAs->setEnabled(true);
}
+ this->adjustSize();
}
void ReceiveRequestDialog::on_btnCopyURI_clicked() which would make @luke-jr happy. I think this is fine because the text area is scrollable - I mean that it's not really the same issue as the intro dialog. |
@promag Repo maintainers, feel free to close this PR as a controversial. |
Please don't close, I don't think this is controversial - I prefer structured GUI instead of a big text area. I was just replying in regards to #17597 (comment). However I wonder if there's really the need to copy the whole text - if so I think a "copy details" button works just fine. Only thing I can point out is if read only line edits are preferable because it's obvious the text can be copied. |
|
QFontMetrics should make it practical to set a minimum width for the textedit widget? |
|
It seems not convenient/accurate when different fonts/styles are mixed in the text: "Address: bc1..." |
This commit does not change behavior.
b8e90f3
to
73529f0
Compare
Rebased b8e90f3 -> 73529f0 (pr17597.06 -> pr17597.07) due to the conflict with #15768. |
Tested ACK 73529f0 |
73529f0 qt: Rename slot to updateDisplayUnit() (Hennadii Stepanov) 68288ef qt: Overhaul ReceiveRequestDialog (Hennadii Stepanov) Pull request description: If master (89a1f7a) is compiled without QR support, the "Request payment to..." dialog looks ugly:  With this PR:    Other minor changes: - "URI" abbreviation is not translated now - wallet name is shown if available ACKs for top commit: jonasschnelli: Tested ACK 73529f0 Tree-SHA512: 45f9a41d3c72978d78eb2e8ca98e274b8be5abf5352fd3e1f4f49514ce744994545fb3012e80600ded936ae41c6be4d4825a0c5f7bcb3db671d69e0299f0f65b
Summary: > If master is compiled without QR support, the "Request payment to..." dialog looks ugly > Other minor changes: > > - "URI" abbreviation is not translated now > - wallet name is shown if available This is a backport of [[bitcoin/bitcoin#17597 | core#17597]] [1/2] bitcoin/bitcoin@68288ef Test Plan: `ninja && ninja check` Build without QR code support and inspect the result. ``` cmake .. -GNinja -DENABLE_QRCODE=OFF ninja && src/qt/bitcoin-qt ``` Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D9922
Summary: This commit does not change behavior. This is a backport of [[bitcoin/bitcoin#17597 | core#17597]] [2/2] bitcoin/bitcoin@73529f0 Test Plan: `ninja` Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D9923
If master (89a1f7a) is compiled without QR support, the "Request payment to..." dialog looks ugly:
With this PR:
Other minor changes: