Skip to content

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Nov 25, 2019

If master (89a1f7a) is compiled without QR support, the "Request payment to..." dialog looks ugly:

Screenshot from 2019-11-25 19-58-59

With this PR:

Screenshot from 2019-12-26 00-42-46

Screenshot from 2019-12-26 00-44-34

Screenshot from 2019-12-26 00-48-51

Other minor changes:

  • "URI" abbreviation is not translated now
  • wallet name is shown if available

@fanquake fanquake added the GUI label Nov 25, 2019
@hebasto
Copy link
Member Author

hebasto commented Nov 25, 2019

We should really try to avoid relying on hardcoded heights. The necessary heght varies based on things such as font size, DPI, styling

Right, but #17597 (comment)

@hebasto hebasto closed this Nov 25, 2019
@laanwj
Copy link
Member

laanwj commented Nov 25, 2019

Wasn't there some other way to pack the window?

@hebasto
Copy link
Member Author

hebasto commented Nov 25, 2019

@laanwj

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.

@hebasto
Copy link
Member Author

hebasto commented Nov 25, 2019

@laanwj

We should really try to avoid relying on hardcoded heights.

We use hardcoded sizes as defaults/minimums/maximums for all windows now.

The necessary heght varies based on things such as font size, DPI, styling.

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.

@hebasto hebasto reopened this Nov 25, 2019
@laanwj
Copy link
Member

laanwj commented Nov 26, 2019

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.

@cvengler
Copy link
Contributor

Haven't tested it yet but I think just a this->adjustSize() would do the job better

@hebasto
Copy link
Member Author

hebasto commented Nov 27, 2019

@emilengler

Haven't tested it yet but I think just a this->adjustSize() would do the job better

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

@hebasto hebasto force-pushed the 20191125-height-without-qr branch from 78c6606 to 56c2d01 Compare December 5, 2019 22:34
@hebasto
Copy link
Member Author

hebasto commented Dec 5, 2019

@laanwj @jonasschnelli @emilengler
Thank you for your reviews.

Wasn't there some other way to pack the window?

Yes, alternative QGridLayout layout is used in the latest push.

We should really try to avoid relying on hardcoded heights. The necessary heght varies based on things such as font size, DPI, styling.

All number in forms/receiverequestdialog.ui are just Qt Designer artefacts.

@DrahtBot
Copy link
Contributor

DrahtBot commented Dec 6, 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 20191125-height-without-qr branch from 04df22e to 23138de Compare December 6, 2019 18:46
@hebasto
Copy link
Member Author

hebasto commented Dec 6, 2019

It seems Travis is happy now.

@hebasto
Copy link
Member Author

hebasto commented Dec 7, 2019

@practicalswift w.r.t. #17658 (comment) would mind reviewing this PR?

@Sjors
Copy link
Member

Sjors commented Dec 10, 2019

I would keep the buttons at the bottom of the dialog, consistent with other dialogs. It doesn't look very nice on macOS, especially with long translations:

Schermafbeelding 2019-12-10 om 13 39 16

Otherwise code in 23138de looks good and it behaves. I also tried --without-qrencode

@hebasto hebasto force-pushed the 20191125-height-without-qr branch from 23138de to cc88011 Compare December 25, 2019 22:49
@hebasto
Copy link
Member Author

hebasto commented Dec 25, 2019

@Sjors
Thank you for your review.

I would keep the buttons at the bottom of the dialog, consistent with other dialogs.

Fixed; also it made diffs smaller ;)

Screenshots in OP have been updated.

@Sjors
Copy link
Member

Sjors commented Jan 2, 2020

Much better. ACK cc88011

Copy link
Member

@luke-jr luke-jr left a 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">
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

@hebasto hebasto Jan 3, 2020

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.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds like a hack

Copy link
Member

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>
Copy link
Member

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

Copy link
Member Author

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>
Copy link
Member

Choose a reason for hiding this comment

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

Close seems more correct.

Copy link
Member Author

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>
Copy link
Member

Choose a reason for hiding this comment

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

This SHOULD be translated...

Copy link
Member Author

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:

Copy link
Member

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

Copy link
Member Author

@hebasto hebasto Jan 3, 2020

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.

Copy link
Member

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.

@hebasto hebasto force-pushed the 20191125-height-without-qr branch from cc88011 to b8e90f3 Compare January 3, 2020 21:31
@hebasto
Copy link
Member Author

hebasto commented Jan 3, 2020

Implemented @luke-jr's comment:

In a label, this becomes clickable.
I'm not sure why we linkify it (so it looks like a link?), but previously it wasn't a clickable link

Fixed tab order.

Copy link
Member

@Sjors Sjors left a 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>
Copy link
Member

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">
Copy link
Member

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.

@promag
Copy link
Contributor

promag commented Jan 6, 2020

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.

@hebasto
Copy link
Member Author

hebasto commented Jan 6, 2020

@promag
Your suggestion was the first I've tried while working on this PR.

The result looks ugly for me:
DeepinScreenshot_bitcoin-qt_20200106182801
Screenshot from 2020-01-06 18-35-44


Repo maintainers, feel free to close this PR as a controversial.

@promag
Copy link
Contributor

promag commented Jan 6, 2020

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.

@hebasto
Copy link
Member Author

hebasto commented Jan 6, 2020

@promag

Only thing I can point out is if read only line edits are preferable because it's obvious the text can be copied.

QLineEdit cannot wrap lines, by design.
Button names, "Copy ...", are self descriptive, no?

@luke-jr
Copy link
Member

luke-jr commented Jan 6, 2020

QFontMetrics should make it practical to set a minimum width for the textedit widget?

@promag
Copy link
Contributor

promag commented Jan 6, 2020

QLineEdit cannot wrap lines, by design.

QLineEdit, QTextEdit.. I mean one that has it's clear the user can select/tab focus and copy. But feel free to ignore the suggestion.

@hebasto
Copy link
Member Author

hebasto commented Feb 8, 2020

@luke-jr

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

@hebasto hebasto force-pushed the 20191125-height-without-qr branch from b8e90f3 to 73529f0 Compare May 5, 2020 02:57
@hebasto
Copy link
Member Author

hebasto commented May 5, 2020

Rebased b8e90f3 -> 73529f0 (pr17597.06 -> pr17597.07) due to the conflict with #15768.

@jonasschnelli
Copy link
Contributor

Tested ACK 73529f0

master:
Bildschirmfoto 2020-05-29 um 09 53 21

With this PR:
Bildschirmfoto 2020-05-29 um 09 57 03

Disabled QRCode support:
Bildschirmfoto 2020-05-29 um 10 00 27

@jonasschnelli jonasschnelli merged commit 3431699 into bitcoin:master May 29, 2020
@hebasto hebasto deleted the 20191125-height-without-qr branch May 29, 2020 09:02
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 31, 2020
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:

  ![Screenshot from 2019-11-25 19-58-59](https://user-images.githubusercontent.com/32963518/69566647-3d9c1c80-0fc0-11ea-8ff6-183cea9372c5.png)

  With this PR:

  ![Screenshot from 2019-12-26 00-42-46](https://user-images.githubusercontent.com/32963518/71451226-221c6100-277a-11ea-94ae-c19a5c6256f7.png)

  ![Screenshot from 2019-12-26 00-44-34](https://user-images.githubusercontent.com/32963518/71451228-29436f00-277a-11ea-8ac5-1bafe6d73b5c.png)

  ![Screenshot from 2019-12-26 00-48-51](https://user-images.githubusercontent.com/32963518/71451230-2e082300-277a-11ea-8c4c-726ca7b776e7.png)

  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
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Aug 24, 2021
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
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Aug 24, 2021
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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
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.

10 participants