From a45fc4ca33fd741ec72f410f5f330b47835fa6ea Mon Sep 17 00:00:00 2001 From: Ralf Ramsauer Date: Tue, 29 Sep 2015 02:13:35 +0200 Subject: [PATCH] Bugfix: QR code generation was case insensitive Also changed Qstring back to std::string --- doorlockd/src/qrwidget.cpp | 4 ++-- doorlockd/src/qrwidget.h | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/doorlockd/src/qrwidget.cpp b/doorlockd/src/qrwidget.cpp index 449fc06..27b4124 100644 --- a/doorlockd/src/qrwidget.cpp +++ b/doorlockd/src/qrwidget.cpp @@ -14,7 +14,7 @@ QRWidget::QRWidget(QWidget* parent) : { } -void QRWidget::setQRData(const QString &data) +void QRWidget::setQRData(const std::string &data) { _data = data; update(); @@ -25,7 +25,7 @@ void QRWidget::paintEvent(QPaintEvent*) QPainter painter(this); std::unique_ptr qr( - QRcode_encodeString(_data.toStdString().c_str(), 1, QR_ECLEVEL_L, QR_MODE_8, 0), + QRcode_encodeString(_data.c_str(), 1, QR_ECLEVEL_L, QR_MODE_8, 1), [] (QRcode* ptr) { if (ptr) QRcode_free(ptr); diff --git a/doorlockd/src/qrwidget.h b/doorlockd/src/qrwidget.h index 7e5afc5..e1652fb 100644 --- a/doorlockd/src/qrwidget.h +++ b/doorlockd/src/qrwidget.h @@ -1,6 +1,8 @@ #ifndef QRWIDGET_H #define QRWIDGET_H +#include + #include class QRWidget : public QWidget @@ -9,10 +11,10 @@ class QRWidget : public QWidget public: explicit QRWidget(QWidget *parent = nullptr); - void setQRData(const QString &data); + void setQRData(const std::string &data); private: - QString _data; + std::string _data; protected: void paintEvent(QPaintEvent *);