mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-02 19:52:01 +02:00
qt, refactor: Limit scope of QPainter object
This commit is contained in:
@ -66,6 +66,7 @@ bool QRImageWidget::setQR(const QString& data, const QString& text)
|
||||
|
||||
QImage qrAddrImage = QImage(QR_IMAGE_SIZE, QR_IMAGE_SIZE + (text.isEmpty() ? 0 : 20), QImage::Format_RGB32);
|
||||
qrAddrImage.fill(0xffffff);
|
||||
{
|
||||
QPainter painter(&qrAddrImage);
|
||||
painter.drawImage(0, 0, qrImage.scaled(QR_IMAGE_SIZE, QR_IMAGE_SIZE));
|
||||
|
||||
@ -82,8 +83,8 @@ bool QRImageWidget::setQR(const QString& data, const QString& text)
|
||||
paddedRect.setHeight(QR_IMAGE_SIZE+12);
|
||||
painter.drawText(paddedRect, Qt::AlignBottom|Qt::AlignCenter, text);
|
||||
}
|
||||
}
|
||||
|
||||
painter.end();
|
||||
setPixmap(QPixmap::fromImage(qrAddrImage));
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user