diff --git a/3rdparty/QrDecoder.cpp b/3rdparty/QrDecoder.cpp index 3c3fcd5..3453b29 100644 --- a/3rdparty/QrDecoder.cpp +++ b/3rdparty/QrDecoder.cpp @@ -12,22 +12,23 @@ QrDecoder::~QrDecoder() quirc_destroy(m_qr); } -QString QrDecoder::decode(const QImage &image) +QVector QrDecoder::decode(const QImage &image) { + QVector result; if (m_qr == nullptr) { - return ""; + return result; } if (quirc_resize(m_qr, image.width(), image.height()) < 0) { - return ""; + return result; } uint8_t *rawImage = quirc_begin(m_qr, nullptr, nullptr); if (rawImage == nullptr) { - return ""; + return result; } #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) std::copy(image.constBits(), image.constBits() + image.sizeInBytes(), rawImage); @@ -39,7 +40,7 @@ QString QrDecoder::decode(const QImage &image) const int count = quirc_count(m_qr); if (count < 0) { - return ""; + return result; } for (int index = 0; index < count; ++index) @@ -51,9 +52,9 @@ QString QrDecoder::decode(const QImage &image) const quirc_decode_error_t err = quirc_decode(&code, &data); if (err == QUIRC_SUCCESS) { - return QLatin1String((const char *)data.payload); + result.append(QLatin1String((const char *)data.payload)); } } - return ""; + return result; } diff --git a/3rdparty/QrDecoder.h b/3rdparty/QrDecoder.h index a1b753c..c8c6789 100644 --- a/3rdparty/QrDecoder.h +++ b/3rdparty/QrDecoder.h @@ -11,7 +11,7 @@ public: QrDecoder(); ~QrDecoder(); - QString decode(const QImage &image); + QVector decode(const QImage &image); private: quirc *m_qr; diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 204f128..9aa46b2 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -1752,12 +1752,14 @@ void MainWindow::on_menu_scan_qr_triggered() { show(); if (ok) { - const QString text = QrDecoder().decode(qpx.toImage().convertToFormat(QImage::Format_Grayscale8)); - if (text.isEmpty()) { + const QVector texts = QrDecoder().decode(qpx.toImage().convertToFormat(QImage::Format_Grayscale8)); + if (texts.isEmpty()) { MessageBoxInfo(software_name, tr("QR Code not found")); } else { - show_log_impl("QR Code Result:\n" + text); - NekoGui_sub::groupUpdater->AsyncUpdate(text); + for (const QString &text : texts) { + show_log_impl("QR Code Result:\n" + text); + NekoGui_sub::groupUpdater->AsyncUpdate(text); + } } } else {