This is a wrapper library of the C++ part of ZXing library. == Getting started == This library is mented to be very simple and will provide as simple as possible the decoding operations. Thus my main purpose is not to support extreme operations and complex techniques that ZXing library does support. Of course, the original ZXing code is still here for everyone interested in using something beyond the already implemented (those of you willing to make more operations available, their code is always welcomed to be merged). Supported barcode types: * Qr Code * Data Matrix (V1.1) * Aztec Code (V1.2) * UPC_E * UPC_A * EAN_8 * EAN_13 * CODE_128 * CODE_39 * ITF The only dependency of this project is the supported functions of the compiler. For instance all G++ based compilers are ok but on the other hand, MSVC doesn't support them that is why at least for now only Mingw compiler is supported for Desktop targets along with Symbian versions. So, if you have a Qt project and your target is to decode a barcode contained in a QImage then this is how is done... == Prerequisites == First you need to download the correct binary version of the library according to your needs. In the Symbian versions there are 2 versions of binaries of each. The selfsigned and the signed. The selfsigned contains the appropriate Capabilities that makes your program selfsignable (-lQZXing_selfsigned). But if you are planning to use additional Capabilities in your project other than those compling to selfsigning then you need to select the singed version (-lQZXing). Be careful on that because if your application uses more capabilities than the library has, your application will keep crashing. Now that it is decided if you need selfsigned or signed version, next step is to select the Deploying target and Qt version. * [https://projects.developer.nokia.com/QZXing/downloads/1 Qt_4.6.3_Symbian^1]: Use this if targeting for Qt versions lower than 4.7. This version doesn't have dependency to the Qt Declarative. Also it contains a binary specially for S60 FP1 (selfsigned) which doesn't contain the Location Capability (in the S60 FP1 Location capability is not selfsigned). * [https://projects.developer.nokia.com/QZXing/downloads/2 "'Qt_4.7.3_Symbian"]: This is the full featured version since it supports QML. * [https://projects.developer.nokia.com/QZXing/downloads/3 Qt_4.7.4_Desktop_Mingw]: If targeting for Desktop applications Mingw is the only compiler supported at the moment. Having selected one of the above 3, you download it. == Including the library == === Symbian Target === In the downloaded package there are 3 folders (include, InstallToDevice, release). Those 3 folders you need to copy them to the EPOC32 root folder of the Symbian SDK you are planing to use. For instance, by default QtSDK is installed under the path C:\QtSDK. If we need to use Symbian^3 and Qt 4.7.4 we copy the 3 folders and paste them to the following path: C:\QtSDK\Symbian\SDKs\Symbian3Qt474\epoc32. This will merge the folders and will add the library files needed for compiling and linking.^ Then in the .pro file of your project the following lines have to be added: symbian{ LIBS += -lqzxing customrules.pkg_prerules = \ ";QZXing" \ "@\"$$(EPOCROOT)Epoc32/InstallToDevice/QZXing_selfsigned.sis\",(0xE618743C)"\ " " DEPLOYMENT += customrules } Pay attention to this line: ` "@\"$$(EPOCROOT)Epoc32/InstallToDevice/QZXing_selfsigned.sis\",(0xE618743C)"\` This is where you will define if you want the selfsigned or the signed version. If signed version needed you have to write: ` "@\"$$(EPOCROOT)Epoc32/InstallToDevice/QZXing_usinged.sis\",(0xE618743C)"\` === Desktop Target === Copy the contents of the package Qt_4.7.4_Desktop_Mingw to a folder in your project. Then add in the .pro file win32{ INCLUDEPATH += "absolute path of the folder where the files where placed" LIBS += -L"absolute path of the folder where the files where placed" \ -lqzxing } == In the code == Where the library needs to be used you have to include the header file: `#include `. Now a QZXing object can be created. It is recommended (but not obligatory) to use one instance of it and decode any number of barcodes you decide. The class supports 3 methods: * setDecoder(DecoderFormat): DecoderFormat is an enumeration regarding the types of barcodes the decoder will try to identify to each decoding. By default all the types are enabled but hence that it is extra processing. If you want to identify specific barcode types you can disable the other. This will result to faster processing. Conjunctions of more than one types of barcodes are supported using logical OR over the enumeration. For example if we need to support both Qt Codes and EAN 13 we need to call the following: QZXing decoder; decoder.setDecoder( DecoderFormat_QR_CODE | DecoderFormat_EAN_13 ); This enable/disable operation of the decoders can be done any time needed. * registerQMLTypes(): If you are planning to use the library in the QML then in the main function you need to call this static function. It will register the QZXing library and make it visible to QML. After that, in the qml file you are planning to use the library you need to write at the top: import QZXing 1.2 * decodeImage(QImage): the method that initiates the decoding. It is made as a slot for convenience. It is blocking function thus if you need your application to continue without freezing, you can call it to an other thread. Finally return the result of the decoding. If an error occurred it will return an empty string \"\". * decodeImageQML(QObject*): the method that has to be called from QML to decode an Image Element. By calling this function the decoder will search the whole picture to find something to decode. As argument is used the Image QML element that holds the image that we want to decode. If is needed to decode only a specific part of the image use decodeSubImageQML. Introduced in version V1.2 * decodeSubImageQML(QObject*, double, double, double, double): the method that has to be called from QML to decode only a portion of an Image Element. First argument is the Image QML element. The rest are as follows: offsetX, offsetY, width, height. * offsetX, offsetY: define the starting point in the image where the portion that needs to be decoded starts. * width, height: the size of the portion that will be decoded. Introduced in version V1.2 * decodingStarted(): signal emitted when decoding starts * decodingFinished(bool succeeded): signal emitted when decoding finishes reporting the success with the boolean. * tagFound(QString tag): emitted upon successful decoding of a barcode. == Examples == The repository contains 2 examples. * QQrDecoder: uses Qt Mobility 1.1.3 with QCamera , VideoFinder and QWidgets. This is the same project previously hosted in [https://projects.developer.nokia.com/QQrDecoder this project page] and [http://www.developer.nokia.com/Community/Wiki/Qr_Decoder_in_Qt this wiki article] (the project page from now gets deprecated since the project will be hosted here from now on). It has known issues that i hope will get fixed at some point: # No automatic focus thus the user needs to press a button to initiate focusing, capturing and eventually decoding. # A few were unable to use it because it constantly throughs various erros such as "General Camera error". * QMLBarcodeDecoder: Needs Qt Mobility 1.2 and Qt 4.7.4 because Camera qml component got supported from that version and on. Hope it will solve the problems we had in the QQrDecoder. And for the closing here is a small pretty QML code contained in the above project showing how it is used: Camera{ id:camera onImageCaptured:{ imageToDecode.source = preview decoder.decodeImageQML(imageToDecode); } } Image{ id:imageToDecode } QZXing{ id: decoder onDecodingStarted: console.log("Decoding of image started...") onTagFound: console.log("Barcode data: " + tag) onDecodingFinished: console.log("Decoding finished " + (succeeded==true ? "successfully" : "unsuccessfully") ) } == The end == Also your feedback is very important :) PS: this project is hosted here as well throughout its development process: https://projects.developer.nokia.com/QZXing. On major changes i update it here as well. One more reference is here: http://www.developer.nokia.com/Community/Wiki/Qr_Decoder_in_Qt