Browse Source

draw qrcode with fixed framesize

3.3.3.1
ThomasV 7 years ago
parent
commit
f994cd4a5d
  1. 11
      electrum/gui/qt/qrcodewidget.py

11
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]:

Loading…
Cancel
Save