commit f994cd4a5d8e30da8f7261fab628eb0f4cd01988
parent f2ad116b0b03eb57e4c898dda2994a310b6768fd
Author: ThomasV <thomasv@electrum.org>
Date: Mon, 16 Jul 2018 13:05:59 +0200
draw qrcode with fixed framesize
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/electrum/gui/qt/qrcodewidget.py b/electrum/gui/qt/qrcodewidget.py
@@ -66,16 +66,15 @@ class QRCodeWidget(QWidget):
framesize = min(r.width(), r.height())
boxsize = int( (framesize - 2*margin)/k )
size = k*boxsize
- left = (r.width() - size)/2
- top = (r.height() - size)/2
-
- # Make a white margin around the QR in case of dark theme use
+ left = (framesize - size)/2
+ top = (framesize - size)/2
+ # Draw white background with margin
qp.setBrush(white)
qp.setPen(white)
- qp.drawRect(left-margin, top-margin, size+(margin*2), size+(margin*2))
+ qp.drawRect(0, 0, framesize, framesize)
+ # Draw qr code
qp.setBrush(black)
qp.setPen(black)
-
for r in range(k):
for c in range(k):
if matrix[r][c]: