[Qt] Use flexible font size for QRCode image address #12173

pull jonasschnelli wants to merge 1 commits into bitcoin:master from jonasschnelli:2018/01/fix_qr_font changing 3 files +20 −2
  1. jonasschnelli commented at 9:36 pm on January 12, 2018: 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:

    Examples Ubuntu non HIDPI:

  2. jonasschnelli added the label GUI on Jan 12, 2018
  3. jonasschnelli added this to the milestone 0.16.0 on Jan 12, 2018
  4. Sjors commented at 1:56 pm on January 13, 2018: member
    Concept ACK
  5. in src/qt/receiverequestdialog.cpp:189 in 07c4e9ea8d outdated
    182@@ -183,9 +183,19 @@ void ReceiveRequestDialog::update()
    183             QPainter painter(&qrAddrImage);
    184             painter.drawImage(0, 0, qrImage.scaled(QR_IMAGE_SIZE, QR_IMAGE_SIZE));
    185             QFont font = GUIUtil::fixedPitchFont();
    186-            font.setPixelSize(12);
    187-            painter.setFont(font);
    188             QRect paddedRect = qrAddrImage.rect();
    189+
    190+            // calculate ideal font size
    191+            qreal fontSize = 14; // don't go larger then 14 points
    


    laanwj commented at 8:35 am on January 15, 2018:
    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.
  6. in src/qt/receiverequestdialog.cpp:190 in 07c4e9ea8d outdated
    187-            painter.setFont(font);
    188             QRect paddedRect = qrAddrImage.rect();
    189+
    190+            // calculate ideal font size
    191+            qreal fontSize = 14; // don't go larger then 14 points
    192+            while(fontSize > 4) {
    


    promag commented at 9:53 am on January 15, 2018:
    Nit, space after while.

    MarcoFalke commented at 3:12 pm on January 15, 2018:
    Since we are nitting: Also, font_size (camel case).
  7. promag commented at 10:10 am on January 15, 2018: member

    Concept ACK.

    Agree with @laanwj.

  8. jonasschnelli force-pushed on Jan 15, 2018
  9. Use flexible font size for QRCode image address 59f9e2aaf3
  10. jonasschnelli force-pushed on Jan 15, 2018
  11. jonasschnelli commented at 7:34 pm on January 15, 2018: contributor
    Factored out the font size calculation, fixed @MarcoFalke’s nit.
  12. MarcoFalke commented at 9:17 pm on January 15, 2018: member

    Appears to work: Before: before After: after

     0-----BEGIN PGP SIGNED MESSAGE-----
     1Hash: SHA512
     2
     3utACK 59f9e2aaf3fe73961cc02042f929b430fee59f9c
     4-----BEGIN PGP SIGNATURE-----
     5
     6iQIcBAEBCgAGBQJaXRoLAAoJENLqSFDnUoslZLkP/16J05ldrI9MrfutOdhgcDwT
     72+rM4V/8FgiAQ7tSzJGp5BLQ2InvZLCYR+34F7xXmOjJiKkfSjC0AuJA5CmugVed
     8zi67g1v6Z9A21VQd/K0PKL4t1fKfyaL21sGgkQHG6xNayKedthI8ACAyr65GsALr
     9D1YxrcF0NgrbR+djLP6WF6yGJiB3kscVasNENcHDtPAwWf/CddKaSSMfqRTyeZ6I
    10GQ57JgGdArndWTrnpSFIVNqT/2ljeVrlQuzQjzL1GKdEgcBcd3NcewLFANBV8ajp
    11Wj9Z3F7afO7RG5ySYDzS4o1Kri/cEiarDxkApLzLViiYGo0UMHv1jGL42/h06zzp
    12VQTbQHyWy9g+Qr2UoRy89SNWNqZGseV76yLpaAaZzzAEawU3GJ107oZw7f2U5CSL
    13KG0Jfn9lI2iJUw2+jRPr4+6kek5+dloBwdU/4w54VKi4c0sHu9oMKVWBo8DU2PhZ
    14PM1LZpWBXsWmipAvSkDVgzA+c9/RpXnu0U+XxrNfbbH5XtiE1SJTc4woWMlxG0zH
    15jnTGMCTTdxClf4QBA/slG6jsgAVahbg5hUMBeO0d2UAMHWXklNtYALT/2QZfZ7gv
    1687IO1QWeBFxStMBuyquOV2L/280hLw10i+fUR58rrcUNWMsvYNib+HcJajCvqoia
    17y9MLx0zq84yA6mPJh8Od
    18=EswI
    19-----END PGP SIGNATURE-----
    
  13. laanwj commented at 10:33 pm on January 15, 2018: member
    utACK 59f9e2a
  14. laanwj merged this on Jan 15, 2018
  15. laanwj closed this on Jan 15, 2018

  16. laanwj referenced this in commit bbc91b7699 on Jan 15, 2018
  17. PastaPastaPasta referenced this in commit 3bee32d565 on Apr 4, 2020
  18. PastaPastaPasta referenced this in commit 7fb5b5b3a5 on Apr 5, 2020
  19. jasonbcox referenced this in commit 357a4cd67b on Sep 23, 2020
  20. ckti referenced this in commit 653005eec4 on Mar 28, 2021
  21. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 15:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me