aboutsummaryrefslogtreecommitdiff
path: root/src/qt/receiverequestdialog.cpp
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2018-01-12 11:09:59 -1000
committerJonas Schnelli <dev@jonasschnelli.ch>2018-01-15 09:33:46 -1000
commit59f9e2aaf3fe73961cc02042f929b430fee59f9c (patch)
tree69ab23e141f12ae3da92b06a6a52a193bb790c39 /src/qt/receiverequestdialog.cpp
parent0910cbe4ef31eb95fd76c7c2f820419fe64a3150 (diff)
Use flexible font size for QRCode image address
Diffstat (limited to 'src/qt/receiverequestdialog.cpp')
-rw-r--r--src/qt/receiverequestdialog.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp
index 209397ca0c..d4cb0e5ba2 100644
--- a/src/qt/receiverequestdialog.cpp
+++ b/src/qt/receiverequestdialog.cpp
@@ -183,9 +183,13 @@ void ReceiveRequestDialog::update()
QPainter painter(&qrAddrImage);
painter.drawImage(0, 0, qrImage.scaled(QR_IMAGE_SIZE, QR_IMAGE_SIZE));
QFont font = GUIUtil::fixedPitchFont();
- font.setPixelSize(12);
- painter.setFont(font);
QRect paddedRect = qrAddrImage.rect();
+
+ // calculate ideal font size
+ qreal font_size = GUIUtil::calculateIdealFontSize(paddedRect.width() - 20, info.address, font);
+ font.setPointSizeF(font_size);
+
+ painter.setFont(font);
paddedRect.setHeight(QR_IMAGE_SIZE+12);
painter.drawText(paddedRect, Qt::AlignBottom|Qt::AlignCenter, info.address);
painter.end();