1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-12-22 02:14:26 +01:00

Bugfix: QR code generation was case insensitive

Also changed Qstring back to std::string
This commit is contained in:
Ralf Ramsauer 2015-09-29 02:13:35 +02:00
parent 2ab091679f
commit a45fc4ca33
2 changed files with 6 additions and 4 deletions

View File

@ -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<QRcode, void(*)(QRcode*)> 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);

View File

@ -1,6 +1,8 @@
#ifndef QRWIDGET_H
#define QRWIDGET_H
#include <string>
#include <QWidget>
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 *);