def METHOD_NAME(self, data):
    if data:
        qr = qrcode.QRCode(
            error_correction=qrcode.constants.ERROR_CORRECT_L,
            box_size=10,
            border=0,
        )
        try:
            qr.add_data(data)
            qr_matrix = qr.get_matrix()  # test that data fits in QR code
        except (ValueError, qrcode.exceptions.DataOverflowError) as e:
            raise QrCodeDataOverflow() from e
        self.qr = qr
        self.data = data
        if not self._manual_size:
            k = len(qr_matrix)
            self.setMinimumSize(k * 5, k * 5)
    else:
        self.qr = None
        self.data = None
    self.update()