def paintQR(self, data):
    if (not data):
        return
    qr = qrcode.QRCode()
    qr.add_data(data)
    matrix = qr.get_matrix()
    k = len(matrix)
    border_color = Qt.white
    base_img = QImage((k * 5), (k * 5), QImage.Format_ARGB32)
    base_img.fill(border_color)
    qrpainter = QPainter()
    qrpainter.begin(base_img)
    boxsize = 5
    size = (k * boxsize)
    left = ((base_img.width() - size) / 2)
    top = ((base_img.height() - size) / 2)
    qrpainter.setBrush(Qt.black)
    qrpainter.setPen(Qt.black)
    for r in range(k):
        for c in range(k):
            if matrix[r][c]:
                qrpainter.drawRect((left + (c * boxsize)), (top + (r * boxsize)), (boxsize - 1), (boxsize - 1))
    qrpainter.end()
    return base_img
def paintQR(self, data):
    if (not data):
        return
    qr = qrcode.QRCode()
    qr.add_data(data)
    matrix = qr.get_matrix()
    k = len(matrix)
    border_color = Qt.white
    base_img = QImage((k * 5), (k * 5), QImage.Format_ARGB32)
    base_img.fill(border_color)
    qrpainter = QPainter()
    qrpainter.begin(base_img)
    boxsize = 5
    size = (k * boxsize)
    left = ((base_img.width() - size) / 2)
    top = ((base_img.height() - size) / 2)
    qrpainter.setBrush(Qt.black)
    qrpainter.setPen(Qt.black)
    for r in range(k):
        for c in range(k):
            if matrix[r][c]:
                qrpainter.drawRect((left + (c * boxsize)), (top + (r * boxsize)), (boxsize - 1), (boxsize - 1))
    qrpainter.end()
    return base_img