From 7a331106f3bcdd0678716f81755b83d634039d39 Mon Sep 17 00:00:00 2001 From: Bent Witthold Date: Thu, 5 Dec 2024 11:17:20 +0100 Subject: [PATCH] Scaling the QR code image to fit in the main window. --- example/MainWindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/example/MainWindow.cpp b/example/MainWindow.cpp index e3c43dc..070a0c7 100644 --- a/example/MainWindow.cpp +++ b/example/MainWindow.cpp @@ -87,8 +87,10 @@ void MainWindow::onGenerateButtonClicked() { auto text = m_lineEdit->text(); // Generate QR code from text - auto image = m_generator.generateQr(text); + QImage unscaledImage = m_generator.generateQr(text); + QImage image = unscaledImage.scaled(500, 500); // Display generated image m_qrCodeDisplay->setPixmap(QPixmap::fromImage(image)); + m_qrCodeDisplay->setToolTip(text); }