commit 9bba65199e80556de0c6efd28258344777ac5a6d
parent 2d739981c2ad356f048801513b284d1faf1bd57b
Author: SomberNight <somber.night@protonmail.com>
Date: Sun, 6 Sep 2020 17:55:11 +0200
Qt QR code: when saving QR code as image file, don't include stretch
The stretch to the right of the QR was included in the image previously.
This resolves the FIXME.
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/electrum/gui/qt/qrcodewidget.py b/electrum/gui/qt/qrcodewidget.py
@@ -106,8 +106,13 @@ class QRDialog(WindowModalDialog):
WindowModalDialog.__init__(self, parent, title)
vbox = QVBoxLayout()
+
qrw = QRCodeWidget(data)
- vbox.addWidget(qrw, 1)
+ qr_hbox = QHBoxLayout()
+ qr_hbox.addWidget(qrw)
+ qr_hbox.addStretch(1)
+ vbox.addLayout(qr_hbox)
+
help_text = data if show_text else help_text
if help_text:
text_label = WWLabel()
@@ -124,7 +129,7 @@ class QRDialog(WindowModalDialog):
filename, __ = QFileDialog.getSaveFileName(self, _("Select where to save file"), "qrcode.png")
if not filename:
return
- p = qrw.grab() # FIXME also grabs neutral colored padding
+ p = qrw.grab()
p.save(filename, 'png')
self.show_message(_("QR code saved to file") + " " + filename)