Skip to content

Commit 8071c75

Browse files
committed
qt, refactor: Limit scope of QPainter object
1 parent 197450f commit 8071c75

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/qt/qrimagewidget.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ bool QRImageWidget::setQR(const QString& data, const QString& text)
6666

6767
QImage qrAddrImage = QImage(QR_IMAGE_SIZE, QR_IMAGE_SIZE + (text.isEmpty() ? 0 : 20), QImage::Format_RGB32);
6868
qrAddrImage.fill(0xffffff);
69+
{
6970
QPainter painter(&qrAddrImage);
7071
painter.drawImage(0, 0, qrImage.scaled(QR_IMAGE_SIZE, QR_IMAGE_SIZE));
7172

@@ -82,8 +83,8 @@ bool QRImageWidget::setQR(const QString& data, const QString& text)
8283
paddedRect.setHeight(QR_IMAGE_SIZE+12);
8384
painter.drawText(paddedRect, Qt::AlignBottom|Qt::AlignCenter, text);
8485
}
86+
}
8587

86-
painter.end();
8788
setPixmap(QPixmap::fromImage(qrAddrImage));
8889

8990
return true;

0 commit comments

Comments
 (0)