qt gui: fix qrcodewidget pen for retina display

This commit is contained in:
zebra-lucky 2019-08-10 03:18:15 +03:00
parent 1c75d939d9
commit 93724ba33a

View file

@ -1,8 +1,9 @@
import os import os
import qrcode import qrcode
from PyQt5.QtGui import QColor from PyQt5.QtGui import QColor, QPen
import PyQt5.QtGui as QtGui import PyQt5.QtGui as QtGui
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
QApplication, QVBoxLayout, QTextEdit, QHBoxLayout, QPushButton, QWidget) QApplication, QVBoxLayout, QTextEdit, QHBoxLayout, QPushButton, QWidget)
@ -48,6 +49,8 @@ class QRCodeWidget(QWidget):
black = QColor(0, 0, 0, 255) black = QColor(0, 0, 0, 255)
white = QColor(255, 255, 255, 255) white = QColor(255, 255, 255, 255)
black_pen = QPen(black)
black_pen.setJoinStyle(Qt.MiterJoin)
if not self.qr: if not self.qr:
qp = QtGui.QPainter() qp = QtGui.QPainter()
@ -77,7 +80,7 @@ class QRCodeWidget(QWidget):
qp.drawRect(0, 0, framesize, framesize) qp.drawRect(0, 0, framesize, framesize)
# Draw qr code # Draw qr code
qp.setBrush(black) qp.setBrush(black)
qp.setPen(black) qp.setPen(black_pen)
for r in range(k): for r in range(k):
for c in range(k): for c in range(k):
if matrix[r][c]: if matrix[r][c]: