Browse Source

qr code widget: set margin to zero, print warning if cannot draw

patch-4
ThomasV 3 years ago
parent
commit
ad70659a66
  1. 7
      electrum/gui/qt/qrcodewidget.py

7
electrum/gui/qt/qrcodewidget.py

@ -20,6 +20,7 @@ class QRCodeWidget(QWidget):
QWidget.__init__(self)
self.data = None
self.qr = None
self.margin = 0
self.fixedSize=fixedSize
if fixedSize:
self.setFixedSize(fixedSize, fixedSize)
@ -69,10 +70,10 @@ class QRCodeWidget(QWidget):
qp = QtGui.QPainter()
qp.begin(self)
r = qp.viewport()
margin = 10
framesize = min(r.width(), r.height())
boxsize = int((framesize - 2*margin)/k)
boxsize = int((framesize - 2*self.margin)/k)
if boxsize < 2:
print('Warning: cannot draw qr code, boxsize too small')
size = k*boxsize
left = (framesize - size)/2
top = (framesize - size)/2

Loading…
Cancel
Save