41 lines
1.3 KiB
Diff
41 lines
1.3 KiB
Diff
From dc41a3f3850308d5204134ae08e66f20a58195f9 Mon Sep 17 00:00:00 2001
|
|
From: Melvin Keskin <melvo@olomono.de>
|
|
Date: Sun, 13 Mar 2022 13:03:16 +0100
|
|
Subject: [PATCH] QrCodeGenerator: Replace deprecated 'BarcodeFormat::QR_CODE'
|
|
with 'BarcodeFormat::QRCode'
|
|
|
|
---
|
|
src/QrCodeGenerator.cpp | 8 ++++++++
|
|
1 file changed, 8 insertions(+)
|
|
|
|
diff --git a/src/QrCodeGenerator.cpp b/src/QrCodeGenerator.cpp
|
|
index b9c8743..1338308 100644
|
|
--- a/src/QrCodeGenerator.cpp
|
|
+++ b/src/QrCodeGenerator.cpp
|
|
@@ -33,6 +33,10 @@
|
|
#include <QImage>
|
|
#include <QRgb>
|
|
|
|
+#include <ZXing/ZXVersion.h>
|
|
+#define ZXING_VERSION \
|
|
+ QT_VERSION_CHECK(ZXING_VERSION_MAJOR, ZXING_VERSION_MINOR, ZXING_VERSION_PATCH)
|
|
+
|
|
#include <ZXing/BarcodeFormat.h>
|
|
#include <ZXing/MultiFormatWriter.h>
|
|
|
|
@@ -74,7 +78,11 @@ QImage QrCodeGenerator::generateBareJidQrCode(int edgePixelCount, const QString
|
|
QImage QrCodeGenerator::generateQrCode(int edgePixelCount, const QString &text)
|
|
{
|
|
try {
|
|
+#if ZXING_VERSION >= QT_VERSION_CHECK(1, 1, 1)
|
|
+ ZXing::MultiFormatWriter writer(ZXing::BarcodeFormat::QRCode);
|
|
+#else
|
|
ZXing::MultiFormatWriter writer(ZXing::BarcodeFormat::QR_CODE);
|
|
+#endif
|
|
const ZXing::BitMatrix &bitMatrix = writer.encode(text.toStdWString(), edgePixelCount, edgePixelCount);
|
|
return toImage(bitMatrix);
|
|
} catch (const std::invalid_argument &e) {
|
|
--
|
|
2.39.1
|
|
|