mirror of https://github.com/status-im/qzxing.git
Move the conversion of Barcode Encode data from the QZXing:encodeData to QZXingImageProvider. The URL-formatted input is provided by the QML code so the conversion must be executed only then. If a user executes QZXing::encodeData directly, it must encode the data as is.
This commit is contained in:
parent
c1f4379ec7
commit
2a58c5032b
|
@ -595,15 +595,13 @@ QImage QZXing::encodeData(const QString &data, const QZXingEncoderConfig &encode
|
|||
{
|
||||
QImage image;
|
||||
|
||||
QString dataTemp(QUrl::fromPercentEncoding(data.toUtf8()));
|
||||
|
||||
try {
|
||||
switch (encoderConfig.format) {
|
||||
#ifdef ENABLE_ENCODER_QR_CODE
|
||||
case EncoderFormat_QR_CODE:
|
||||
{
|
||||
Ref<qrcode::QRCode> barcode = qrcode::Encoder::encode(
|
||||
dataTemp.toStdWString(),
|
||||
data.toStdWString(),
|
||||
encoderConfig.errorCorrectionLevel == EncodeErrorCorrectionLevel_H ?
|
||||
qrcode::ErrorCorrectionLevel::H :
|
||||
(encoderConfig.errorCorrectionLevel == EncodeErrorCorrectionLevel_Q ?
|
||||
|
|
|
@ -72,7 +72,9 @@ QImage QZXingImageProvider::requestImage(const QString &id, QSize *size, const Q
|
|||
|
||||
QZXingEncoderConfig encoderConfig(format, requestedSize, correctionLevel, border, transparent);
|
||||
|
||||
QImage result = QZXing::encodeData(data, encoderConfig);
|
||||
QString dataTemp(QUrl::fromPercentEncoding(data.toUtf8()));
|
||||
|
||||
QImage result = QZXing::encodeData(dataTemp, encoderConfig);
|
||||
*size = result.size();
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue