|
|
@ -166,7 +166,6 @@ class QRCodeWidget(QWidget): |
|
|
|
|
|
|
|
black = QColor(0, 0, 0, 255) |
|
|
|
white = QColor(255, 255, 255, 255) |
|
|
|
boxsize = 6 |
|
|
|
|
|
|
|
if not self.qr: |
|
|
|
qp = QtGui.QPainter() |
|
|
@ -176,11 +175,16 @@ class QRCodeWidget(QWidget): |
|
|
|
qp.drawRect(0, 0, 198, 198) |
|
|
|
qp.end() |
|
|
|
return |
|
|
|
|
|
|
|
size = self.qr.getModuleCount()*boxsize |
|
|
|
|
|
|
|
k = self.qr.getModuleCount() |
|
|
|
qp = QtGui.QPainter() |
|
|
|
qp.begin(self) |
|
|
|
r = qp.viewport() |
|
|
|
boxsize = min(r.width(), r.height())*0.8/k |
|
|
|
size = k*boxsize |
|
|
|
left = (r.width() - size)/2 |
|
|
|
top = (r.height() - size)/2 |
|
|
|
|
|
|
|
for r in range(k): |
|
|
|
for c in range(k): |
|
|
|
if self.qr.isDark(r, c): |
|
|
@ -189,7 +193,7 @@ class QRCodeWidget(QWidget): |
|
|
|
else: |
|
|
|
qp.setBrush(white) |
|
|
|
qp.setPen(white) |
|
|
|
qp.drawRect(c*boxsize, r*boxsize, boxsize, boxsize) |
|
|
|
qp.drawRect(left+c*boxsize, top+r*boxsize, boxsize, boxsize) |
|
|
|
qp.end() |
|
|
|
|
|
|
|
|
|
|
@ -1200,8 +1204,8 @@ class ElectrumWindow(QMainWindow): |
|
|
|
d.setMinimumSize(270, 300) |
|
|
|
vbox = QVBoxLayout() |
|
|
|
qrw = QRCodeWidget(data) |
|
|
|
vbox.addWidget(qrw) |
|
|
|
vbox.addWidget(QLabel(data)) |
|
|
|
vbox.addWidget(qrw, 1) |
|
|
|
vbox.addWidget(QLabel(data), 0, Qt.AlignHCenter) |
|
|
|
hbox = QHBoxLayout() |
|
|
|
hbox.addStretch(1) |
|
|
|
|
|
|
|