From 735f07bad13a801dd1636015277b02c2f8e8484c Mon Sep 17 00:00:00 2001 From: adityapk00 Date: Tue, 30 Oct 2018 21:42:24 -0700 Subject: [PATCH] center qrcode --- src/qrcodelabel.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/qrcodelabel.cpp b/src/qrcodelabel.cpp index 97a4306..d7541be 100644 --- a/src/qrcodelabel.cpp +++ b/src/qrcodelabel.cpp @@ -31,7 +31,8 @@ QPixmap QRCodeLabel::scaledPixmap() const { const double aspect = w/h; const double size = ((aspect>1.0)?h:w); const double scale = size/(s+2); - const double offset = (w - size) > 0 ? (w - size) / 2 : 0; + const double woff = (w - size) > 0 ? (w - size) / 2 : 0; + const double hoff = (h - size) > 0 ? (h - size) / 2 : 0; // NOTE: For performance reasons my implementation only draws the foreground parts painter.setPen(Qt::NoPen); @@ -40,7 +41,7 @@ QPixmap QRCodeLabel::scaledPixmap() const { for(int x=0; x