From a176fd841b494ebe270076389aad85cc10df024c Mon Sep 17 00:00:00 2001 From: favoritas37 Date: Mon, 1 Jun 2015 16:58:16 +0300 Subject: [PATCH] applied patch from Alexxey593 from here: https://sourceforge.net/p/qzxing/discussion/general/thread/770fb0a5/#1d98 --- source/QZXing.h | 10 ++++++++-- source/qzxing.cpp | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/source/QZXing.h b/source/QZXing.h index 1de740c..f0fe429 100644 --- a/source/QZXing.h +++ b/source/QZXing.h @@ -11,6 +11,12 @@ #include #endif +// forward declaration +namespace zxing { +class MultiFormatReader; +} +class ImageHandler; + /** * A class containing a very very small subset of the ZXing library. * Created for ease of use. @@ -143,9 +149,9 @@ signals: void enabledFormatsChanged(); private: - void* decoder; + zxing::MultiFormatReader* decoder; DecoderFormatType enabledDecoders; - QObject* imageHandler; + ImageHandler* imageHandler; int processingTime; /** diff --git a/source/qzxing.cpp b/source/qzxing.cpp index 922c86e..b4e13a3 100644 --- a/source/qzxing.cpp +++ b/source/qzxing.cpp @@ -135,7 +135,7 @@ QString QZXing::decodeImage(QImage &image, int maxWidth, int maxHeight, bool smo Ref ref(bb); - res = ((MultiFormatReader*)decoder)->decode(ref, DecodeHints((int)enabledDecoders)); + res = decoder->decode(ref, DecodeHints((int)enabledDecoders)); QString string = QString(res->getText()->getText().c_str()); processingTime = t.elapsed(); @@ -177,7 +177,7 @@ QString QZXing::decodeSubImageQML(QObject* item, return ""; } - QImage img = ((ImageHandler*)imageHandler)->extractQImage(item, offsetX, offsetY, width, height); + QImage img = imageHandler->extractQImage(item, offsetX, offsetY, width, height); return decodeImage(img); }