Merge pull request #125 from promag/2019-08-fix-optional-format

Fix optional format in image provider
This commit is contained in:
Nikolaos Ftylitakis 2019-08-05 16:31:54 +03:00 committed by GitHub
commit 897526702f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -38,14 +38,15 @@ QImage QZXingImageProvider::requestImage(const QString &id, QSize *size, const Q
// it could not recognize the first key-value pair provided
QUrlQuery optionQuery("options?dummy=&" + id.mid(customSettingsIndex + 1));
QString correctionLevelString = optionQuery.queryItemValue("corretionLevel");
QString formatString = optionQuery.queryItemValue("format");
if(formatString != "qrcode")
{
qWarning() << "Format not supported: " << formatString;
return QImage();
if (optionQuery.hasQueryItem("format")) {
QString formatString = optionQuery.queryItemValue("format");
if (formatString != "qrcode") {
qWarning() << "Format not supported: " << formatString;
return QImage();
}
}
QString correctionLevelString = optionQuery.queryItemValue("corretionLevel");
if(correctionLevelString == "H")
correctionLevel = QZXing::EncodeErrorCorrectionLevel_H;
else if(correctionLevelString == "Q")