From 5de416671e950621c424c2d1814a7028b64108ac Mon Sep 17 00:00:00 2001 From: Alfred Neumayer Date: Wed, 17 Aug 2022 07:44:48 +0200 Subject: [PATCH] src: Support Ubuntu Touch in QZXingFilter With qtubuntu-camera gaining basic viewfinder mapping support it is possible to make use of QZXingFilter in Ubuntu Touch apps. Consumers of the library may either use 'CONFIG+=ubports' in their qmake projects, or define Q_OS_UBUNTUTOUCH themselves when using CMake since QZXing can easily be built as a subproject. --- src/QZXing-components.pri | 4 ++++ src/QZXingFilter.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/QZXing-components.pri b/src/QZXing-components.pri index b32b512..d706fa6 100644 --- a/src/QZXing-components.pri +++ b/src/QZXing-components.pri @@ -450,6 +450,10 @@ unix { DEFINES += NOFMAXL + contains( CONFIG, ubports) { + DEFINES += Q_OS_UBUNTUTOUCH + } + contains( CONFIG, sailfishapp) { DEFINES += Q_OS_SAILFISH } else { diff --git a/src/QZXingFilter.cpp b/src/QZXingFilter.cpp index 3fdeb6c..4edb468 100644 --- a/src/QZXingFilter.cpp +++ b/src/QZXingFilter.cpp @@ -196,7 +196,7 @@ static QImage* rgbDataToGrayscale(const uchar* data, const CaptureRect& captureR for (int y = 1; y <= captureRect.targetHeight; ++y) { //Quick fix for iOS & macOS devices. Will be handled better in the future -#if defined(Q_OS_IOS) || defined (Q_OS_MAC) || defined(Q_OS_SAILFISH) +#if defined(Q_OS_IOS) || defined (Q_OS_MAC) || defined(Q_OS_SAILFISH) || defined(Q_OS_UBUNTUTOUCH) uchar* pixel = pixelInit + (y - 1) * captureRect.targetWidth; #else uchar* pixel = pixelInit + (captureRect.targetHeight - y) * captureRect.targetWidth;