mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 09:21:39 +00:00
fixedSize qrcode widget
This commit is contained in:
parent
3fa113d76b
commit
e5b44bacda
2 changed files with 8 additions and 4 deletions
|
@ -687,7 +687,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
grid.addWidget(clear_button, 3, 2)
|
grid.addWidget(clear_button, 3, 2)
|
||||||
grid.setRowStretch(4, 1)
|
grid.setRowStretch(4, 1)
|
||||||
|
|
||||||
self.receive_qr = QRCodeWidget()
|
self.receive_qr = QRCodeWidget(fixedSize=200)
|
||||||
grid.addWidget(self.receive_qr, 0, 4, 5, 2)
|
grid.addWidget(self.receive_qr, 0, 4, 5, 2)
|
||||||
|
|
||||||
grid.setRowStretch(5, 1)
|
grid.setRowStretch(5, 1)
|
||||||
|
|
|
@ -13,10 +13,13 @@ from electrum.i18n import _
|
||||||
|
|
||||||
class QRCodeWidget(QWidget):
|
class QRCodeWidget(QWidget):
|
||||||
|
|
||||||
def __init__(self, data = None):
|
def __init__(self, data = None, fixedSize=False):
|
||||||
QWidget.__init__(self)
|
QWidget.__init__(self)
|
||||||
self.data = None
|
self.data = None
|
||||||
self.qr = None
|
self.qr = None
|
||||||
|
self.fixedSize=fixedSize
|
||||||
|
if fixedSize:
|
||||||
|
self.setFixedSize(fixedSize, fixedSize)
|
||||||
self.setData(data)
|
self.setData(data)
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,6 +29,7 @@ class QRCodeWidget(QWidget):
|
||||||
if self.data:
|
if self.data:
|
||||||
self.qr = qrcode.QRCode()
|
self.qr = qrcode.QRCode()
|
||||||
self.qr.add_data(self.data)
|
self.qr.add_data(self.data)
|
||||||
|
if not self.fixedSize:
|
||||||
k = len(self.qr.get_matrix())
|
k = len(self.qr.get_matrix())
|
||||||
self.setMinimumSize(k*5,k*5)
|
self.setMinimumSize(k*5,k*5)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Reference in a new issue