Skip to content
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] Use flexible font size for QRCode image address #12173

Merged
merged 1 commit into from Jan 15, 2018

Conversation

jonasschnelli
Copy link
Contributor

Bech32 addresses are currently cut off in the QRCode image in the GUI receive tab.
This adds a simple font size calculation logic that "must" (down to 4pt) fix into the given image width.

Examples OSX HiDPI:
bildschirmfoto 2018-01-12 um 11 25 40
bildschirmfoto 2018-01-12 um 11 25 46

Examples Ubuntu non HIDPI:
bildschirmfoto 2018-01-12 um 11 27 51
bildschirmfoto 2018-01-12 um 11 27 42

@Sjors
Copy link
Member

Sjors commented Jan 13, 2018

Concept ACK

QRect paddedRect = qrAddrImage.rect();

// calculate ideal font size
qreal fontSize = 14; // don't go larger then 14 points
Copy link
Member

Choose a reason for hiding this comment

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

Please factor this out into a function: this makes it easier to read and I think this might come in useful in other places as well.

Copy link
Member

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

Concept ACK.

Agree with @laanwj.


// calculate ideal font size
qreal fontSize = 14; // don't go larger then 14 points
while(fontSize > 4) {
Copy link
Member

Choose a reason for hiding this comment

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

Nit, space after while.

Copy link
Member

Choose a reason for hiding this comment

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

Since we are nitting: Also, font_size (camel case).

@jonasschnelli
Copy link
Contributor Author

Factored out the font size calculation, fixed @MarcoFalke's nit.

@mess110
Copy link
Contributor

mess110 commented Jan 15, 2018

ACK 59f9e2a

@maflcko
Copy link
Member

maflcko commented Jan 15, 2018

Appears to work:
Before:
before
After:
after

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

utACK 59f9e2aaf3fe73961cc02042f929b430fee59f9c
-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJaXRoLAAoJENLqSFDnUoslZLkP/16J05ldrI9MrfutOdhgcDwT
2+rM4V/8FgiAQ7tSzJGp5BLQ2InvZLCYR+34F7xXmOjJiKkfSjC0AuJA5CmugVed
zi67g1v6Z9A21VQd/K0PKL4t1fKfyaL21sGgkQHG6xNayKedthI8ACAyr65GsALr
D1YxrcF0NgrbR+djLP6WF6yGJiB3kscVasNENcHDtPAwWf/CddKaSSMfqRTyeZ6I
GQ57JgGdArndWTrnpSFIVNqT/2ljeVrlQuzQjzL1GKdEgcBcd3NcewLFANBV8ajp
Wj9Z3F7afO7RG5ySYDzS4o1Kri/cEiarDxkApLzLViiYGo0UMHv1jGL42/h06zzp
VQTbQHyWy9g+Qr2UoRy89SNWNqZGseV76yLpaAaZzzAEawU3GJ107oZw7f2U5CSL
KG0Jfn9lI2iJUw2+jRPr4+6kek5+dloBwdU/4w54VKi4c0sHu9oMKVWBo8DU2PhZ
PM1LZpWBXsWmipAvSkDVgzA+c9/RpXnu0U+XxrNfbbH5XtiE1SJTc4woWMlxG0zH
jnTGMCTTdxClf4QBA/slG6jsgAVahbg5hUMBeO0d2UAMHWXklNtYALT/2QZfZ7gv
87IO1QWeBFxStMBuyquOV2L/280hLw10i+fUR58rrcUNWMsvYNib+HcJajCvqoia
y9MLx0zq84yA6mPJh8Od
=EswI
-----END PGP SIGNATURE-----

@laanwj
Copy link
Member

laanwj commented Jan 15, 2018

utACK 59f9e2a

@laanwj laanwj merged commit 59f9e2a into bitcoin:master Jan 15, 2018
laanwj added a commit that referenced this pull request Jan 15, 2018
59f9e2a Use flexible font size for QRCode image address (Jonas Schnelli)

Pull request description:

  Bech32 addresses are currently cut off in the QRCode image in the GUI receive tab.
  This adds a simple font size calculation logic that "must" (down to 4pt) fix into the given image width.

  Examples OSX HiDPI:
  <img width="332" alt="bildschirmfoto 2018-01-12 um 11 25 40" src="https://user-images.githubusercontent.com/178464/34896144-c0c65d76-f78c-11e7-93e1-94dc8e203269.png">
  <img width="322" alt="bildschirmfoto 2018-01-12 um 11 25 46" src="https://user-images.githubusercontent.com/178464/34896145-c0edfe1c-f78c-11e7-8c09-c15155e2160e.png">

  Examples Ubuntu non HIDPI:
  <img width="314" alt="bildschirmfoto 2018-01-12 um 11 27 51" src="https://user-images.githubusercontent.com/178464/34896151-c88347f4-f78c-11e7-8a03-df8049dcfed6.png">
  <img width="322" alt="bildschirmfoto 2018-01-12 um 11 27 42" src="https://user-images.githubusercontent.com/178464/34896152-c8bb881c-f78c-11e7-89d2-6f04ec608a19.png">

Tree-SHA512: d749763fb748b146f77fd8d88fb7d29b07a46cde0b0f303a4006ae9cc3521b3c2e8ab43b828e243514109379898b198552e17b8f316c5a869b0cc8246b054b86
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Apr 4, 2020
…ress

59f9e2a Use flexible font size for QRCode image address (Jonas Schnelli)

Pull request description:

  Bech32 addresses are currently cut off in the QRCode image in the GUI receive tab.
  This adds a simple font size calculation logic that "must" (down to 4pt) fix into the given image width.

  Examples OSX HiDPI:
  <img width="332" alt="bildschirmfoto 2018-01-12 um 11 25 40" src="https://user-images.githubusercontent.com/178464/34896144-c0c65d76-f78c-11e7-93e1-94dc8e203269.png">
  <img width="322" alt="bildschirmfoto 2018-01-12 um 11 25 46" src="https://user-images.githubusercontent.com/178464/34896145-c0edfe1c-f78c-11e7-8c09-c15155e2160e.png">

  Examples Ubuntu non HIDPI:
  <img width="314" alt="bildschirmfoto 2018-01-12 um 11 27 51" src="https://user-images.githubusercontent.com/178464/34896151-c88347f4-f78c-11e7-8a03-df8049dcfed6.png">
  <img width="322" alt="bildschirmfoto 2018-01-12 um 11 27 42" src="https://user-images.githubusercontent.com/178464/34896152-c8bb881c-f78c-11e7-89d2-6f04ec608a19.png">

Tree-SHA512: d749763fb748b146f77fd8d88fb7d29b07a46cde0b0f303a4006ae9cc3521b3c2e8ab43b828e243514109379898b198552e17b8f316c5a869b0cc8246b054b86
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Apr 5, 2020
…ress

59f9e2a Use flexible font size for QRCode image address (Jonas Schnelli)

Pull request description:

  Bech32 addresses are currently cut off in the QRCode image in the GUI receive tab.
  This adds a simple font size calculation logic that "must" (down to 4pt) fix into the given image width.

  Examples OSX HiDPI:
  <img width="332" alt="bildschirmfoto 2018-01-12 um 11 25 40" src="https://user-images.githubusercontent.com/178464/34896144-c0c65d76-f78c-11e7-93e1-94dc8e203269.png">
  <img width="322" alt="bildschirmfoto 2018-01-12 um 11 25 46" src="https://user-images.githubusercontent.com/178464/34896145-c0edfe1c-f78c-11e7-8c09-c15155e2160e.png">

  Examples Ubuntu non HIDPI:
  <img width="314" alt="bildschirmfoto 2018-01-12 um 11 27 51" src="https://user-images.githubusercontent.com/178464/34896151-c88347f4-f78c-11e7-8a03-df8049dcfed6.png">
  <img width="322" alt="bildschirmfoto 2018-01-12 um 11 27 42" src="https://user-images.githubusercontent.com/178464/34896152-c8bb881c-f78c-11e7-89d2-6f04ec608a19.png">

Tree-SHA512: d749763fb748b146f77fd8d88fb7d29b07a46cde0b0f303a4006ae9cc3521b3c2e8ab43b828e243514109379898b198552e17b8f316c5a869b0cc8246b054b86
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Sep 23, 2020
Summary:
Use flexible font size for QRCode image address (Jonas Schnelli)

Pull request description:

  Bech32 addresses are currently cut off in the QRCode image in the GUI receive tab.
  This adds a simple font size calculation logic that "must" (down to 4pt) fix into the given image width.

  Examples OSX HiDPI:
  <img width="332" alt="bildschirmfoto 2018-01-12 um 11 25 40" src="https://user-images.githubusercontent.com/178464/34896144-c0c65d76-f78c-11e7-93e1-94dc8e203269.png">
  <img width="322" alt="bildschirmfoto 2018-01-12 um 11 25 46" src="https://user-images.githubusercontent.com/178464/34896145-c0edfe1c-f78c-11e7-8c09-c15155e2160e.png">

  Examples Ubuntu non HIDPI:
  <img width="314" alt="bildschirmfoto 2018-01-12 um 11 27 51" src="https://user-images.githubusercontent.com/178464/34896151-c88347f4-f78c-11e7-8a03-df8049dcfed6.png">
  <img width="322" alt="bildschirmfoto 2018-01-12 um 11 27 42" src="https://user-images.githubusercontent.com/178464/34896152-c8bb881c-f78c-11e7-89d2-6f04ec608a19.png">

---

Backport of Core [[bitcoin/bitcoin#12173 | PR12173]]

Test Plan:
  ninja
  bitcoin-qt -regtest, check the receive tab for correctness

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D7524
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 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.

None yet

6 participants