mirror of https://github.com/status-im/qzxing.git
Updated REAME files with Qt 6 limitations
This commit is contained in:
parent
08a75a8e32
commit
9c80b90d7c
191
README.md
191
README.md
|
@ -1,106 +1,128 @@
|
||||||
# qzxing [![Build Status](https://travis-ci.com/ftylitak/qzxing.svg?branch=master)](https://travis-ci.com/ftylitak/qzxing) [![Build Status](https://ci.appveyor.com/api/projects/status/0033p4dyo49iy5jq?svg=true)](https://ci.appveyor.com/project/ftylitak/qzxing) [![Total alerts](https://img.shields.io/lgtm/alerts/g/ftylitak/qzxing.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/ftylitak/qzxing/alerts/) [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/ftylitak/qzxing.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/ftylitak/qzxing/context:cpp)
|
# qzxing [![Build Status](https://travis-ci.com/ftylitak/qzxing.svg?branch=master)](https://travis-ci.com/ftylitak/qzxing) [![Build Status](https://ci.appveyor.com/api/projects/status/0033p4dyo49iy5jq?svg=true)](https://ci.appveyor.com/project/ftylitak/qzxing) [![Total alerts](https://img.shields.io/lgtm/alerts/g/ftylitak/qzxing.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/ftylitak/qzxing/alerts/) [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/ftylitak/qzxing.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/ftylitak/qzxing/context:cpp)
|
||||||
Qt/QML wrapper library for the [ZXing](https://github.com/zxing/zxing) barcode image processing library.
|
|
||||||
|
|
||||||
Supports barcode decoding for the following types:
|
Qt/QML wrapper library for the [ZXing](https://github.com/zxing/zxing) barcode image processing library.
|
||||||
|
|
||||||
|
Supports barcode decoding for the following types:
|
||||||
|
|
||||||
|
- UPC-A
|
||||||
|
- UPC-E
|
||||||
|
- EAN-8
|
||||||
|
- EAN-13
|
||||||
|
- ITF
|
||||||
|
- Code 39
|
||||||
|
- Code 93
|
||||||
|
- Code 128 (GS1)
|
||||||
|
- Codabar
|
||||||
|
- QR Code
|
||||||
|
- Data Matrix
|
||||||
|
- Aztec (beta)
|
||||||
|
- PDF 417
|
||||||
|
|
||||||
|
Supports barcode encoding for the following types:
|
||||||
|
|
||||||
|
- QR Code
|
||||||
|
|
||||||
* UPC-A
|
|
||||||
* UPC-E
|
|
||||||
* EAN-8
|
|
||||||
* EAN-13
|
|
||||||
* ITF
|
|
||||||
* Code 39
|
|
||||||
* Code 93
|
|
||||||
* Code 128 (GS1)
|
|
||||||
* Codabar
|
|
||||||
* QR Code
|
|
||||||
* Data Matrix
|
|
||||||
* Aztec (beta)
|
|
||||||
* PDF 417
|
|
||||||
|
|
||||||
Supports barcode encoding for the following types:
|
|
||||||
|
|
||||||
* QR Code
|
|
||||||
|
|
||||||
# Table of contents
|
# Table of contents
|
||||||
|
|
||||||
1. [How to include](#howToInclude)
|
1. [How to include](#howToInclude)
|
||||||
1. [Embed the source code](#embedInSourceCode)
|
1. [Embed the source code](#embedInSourceCode)
|
||||||
1. [Compile the project as an external library](#externalLibrary)
|
1. [Compile the project as an external library](#externalLibrary)
|
||||||
1. [Control dependencies](#controlDependencies)
|
1. [Control dependencies](#controlDependencies)
|
||||||
1. [QZXing (core)](#controlDependenciesCore)
|
1. [QZXing (core)](#controlDependenciesCore)
|
||||||
1. [QZXing (core + QML)](#controlDependenciesCoreQML)
|
1. [QZXing (core + QML)](#controlDependenciesCoreQML)
|
||||||
1. [QZXing + QZXingFilter](#controlDependenciesCoreQMLQZXingFilter)
|
1. [QZXing + QZXingFilter](#controlDependenciesCoreQMLQZXingFilter)
|
||||||
1. [How to use](#howTo)
|
1. [How to use](#howTo)
|
||||||
1. [Decoding operation](#howToDecoding)
|
1. [Decoding operation](#howToDecoding)
|
||||||
1. [C++/Qt](#howToDecodingCPP)
|
1. [C++/Qt](#howToDecodingCPP)
|
||||||
1. [Qt Quick](#howToDecodingQtQuick)
|
1. [Qt Quick](#howToDecodingQtQuick)
|
||||||
1. [Encoding operation](#howToEncoding)
|
1. [Encoding operation](#howToEncoding)
|
||||||
1. [C++/Qt](#howToEncodingCPP)
|
1. [C++/Qt](#howToEncodingCPP)
|
||||||
1. [Qt Quick](#howToEncodingQtQuick)
|
1. [Qt Quick](#howToEncodingQtQuick)
|
||||||
1. [Encoded text format Information](#howToEncodingFormatExamples)
|
1. [Encoded text format Information](#howToEncodingFormatExamples)
|
||||||
1. [Unit test dependency](#unitTestDependency)
|
1. [Unit test dependency](#unitTestDependency)
|
||||||
|
1. [Qt 6 limitations](#qt6limitations)
|
||||||
1. [Contact](#contact)
|
1. [Contact](#contact)
|
||||||
|
|
||||||
<a name="howToInclude"></a>
|
<a name="howToInclude"></a>
|
||||||
|
|
||||||
# How to include
|
# How to include
|
||||||
|
|
||||||
The project can be used in two ways:
|
The project can be used in two ways:
|
||||||
<a name="embedInSourceCode"></a>
|
<a name="embedInSourceCode"></a>
|
||||||
## Embed the source code.
|
|
||||||
|
## Embed the source code.
|
||||||
|
|
||||||
Copy source code folder of QZXing to the root of your project. Add the following line to your .pro file. For more information see [here](https://github.com/ftylitak/qzxing/wiki/Using-the-QZXing-through-the-source-code).
|
Copy source code folder of QZXing to the root of your project. Add the following line to your .pro file. For more information see [here](https://github.com/ftylitak/qzxing/wiki/Using-the-QZXing-through-the-source-code).
|
||||||
|
|
||||||
```qmake
|
```qmake
|
||||||
include(QZXing/QZXing.pri)
|
include(QZXing/QZXing.pri)
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="externalLibrary"></a>
|
<a name="externalLibrary"></a>
|
||||||
|
|
||||||
## Compile the project as an external library
|
## Compile the project as an external library
|
||||||
|
|
||||||
Open QZXing project (QZXing.pro) and compile. If it is needed to compile as static library, uncomment the following line in the .pro file.
|
Open QZXing project (QZXing.pro) and compile. If it is needed to compile as static library, uncomment the following line in the .pro file.
|
||||||
|
|
||||||
```qmake
|
```qmake
|
||||||
CONFIG += staticlib
|
CONFIG += staticlib
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="controlDependencies"></a>
|
<a name="controlDependencies"></a>
|
||||||
## Control dependencies
|
|
||||||
|
## Control dependencies
|
||||||
|
|
||||||
Project file config tags are now introduced to be able to control the dependencies of the library accoring to the needs.
|
Project file config tags are now introduced to be able to control the dependencies of the library accoring to the needs.
|
||||||
The core part requires only "core" and "gui" Qt modules. Though for backward compatibility "quick" Qt module is also required.
|
The core part requires only "core" and "gui" Qt modules. Though for backward compatibility "quick" Qt module is also required.
|
||||||
The 3 level of dependencies are:
|
The 3 level of dependencies are:
|
||||||
|
|
||||||
<a name="controlDependenciesCore"></a>
|
<a name="controlDependenciesCore"></a>
|
||||||
### QZXing (core)
|
|
||||||
|
### QZXing (core)
|
||||||
|
|
||||||
By including QZXing.pri or by building QZXing.pro you get the core functionality of QZXing which requires only QtCore and QtGui (because of QImage).
|
By including QZXing.pri or by building QZXing.pro you get the core functionality of QZXing which requires only QtCore and QtGui (because of QImage).
|
||||||
|
|
||||||
Warning! The initial default configuration till 20/03/2017 was including qzxing_qml. This tag could not be removed once added, so it was needed to be removed from the defaults.
|
Warning! The initial default configuration till 20/03/2017 was including qzxing_qml. This tag could not be removed once added, so it was needed to be removed from the defaults.
|
||||||
|
|
||||||
<a name="controlDependenciesCoreQML"></a>
|
<a name="controlDependenciesCoreQML"></a>
|
||||||
### QZXing (core + QML)
|
|
||||||
|
### QZXing (core + QML)
|
||||||
|
|
||||||
If an application is going to use QML functionality, it is now possible to add the dependency to it. This can be done by adding the folloing line to the .pro file of its project:
|
If an application is going to use QML functionality, it is now possible to add the dependency to it. This can be done by adding the folloing line to the .pro file of its project:
|
||||||
|
|
||||||
```qmake
|
```qmake
|
||||||
CONFIG += qzxing_qml
|
CONFIG += qzxing_qml
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="controlDependenciesCoreQMLQZXingFilter"></a>
|
<a name="controlDependenciesCoreQMLQZXingFilter"></a>
|
||||||
### QZXing + QZXingFilter
|
|
||||||
|
### QZXing + QZXingFilter
|
||||||
|
|
||||||
QZXing includes QZXingFilter, a QAbstractVideoFilter implementation to provide a mean of providing live feed to the decoding library. It automatically includes QML implementation as well.
|
QZXing includes QZXingFilter, a QAbstractVideoFilter implementation to provide a mean of providing live feed to the decoding library. It automatically includes QML implementation as well.
|
||||||
This option requires "multimedia" Qt module this is why it is considered as a separate configuration. It can be used by adding the folloing line to the .pro file of a project:
|
This option requires "multimedia" Qt module this is why it is considered as a separate configuration. It can be used by adding the folloing line to the .pro file of a project:
|
||||||
|
|
||||||
```qmake
|
```qmake
|
||||||
CONFIG += qzxing_multimedia
|
CONFIG += qzxing_multimedia
|
||||||
```
|
```
|
||||||
<a name="howTo"></a>
|
|
||||||
# How to use
|
<a name="howTo"></a>
|
||||||
|
|
||||||
|
# How to use
|
||||||
|
|
||||||
Follows simple code snippets that brefly show the use of the library. For more details advise the examples included in the repository and the [wiki](https://github.com/ftylitak/qzxing/wiki).
|
Follows simple code snippets that brefly show the use of the library. For more details advise the examples included in the repository and the [wiki](https://github.com/ftylitak/qzxing/wiki).
|
||||||
|
|
||||||
<a name="howToDecoding"></a>
|
<a name="howToDecoding"></a>
|
||||||
## Decoding operation
|
|
||||||
|
## Decoding operation
|
||||||
|
|
||||||
<a name="howToDecodingCPP"></a>
|
<a name="howToDecodingCPP"></a>
|
||||||
### C++/Qt
|
|
||||||
|
### C++/Qt
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
#include "QZXing.h"
|
#include "QZXing.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
QImage imageToDecode("file.png");
|
QImage imageToDecode("file.png");
|
||||||
QZXing decoder;
|
QZXing decoder;
|
||||||
|
@ -116,24 +138,25 @@ int main()
|
||||||
QString result = decoder.decodeImage(imageToDecode);
|
QString result = decoder.decodeImage(imageToDecode);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="howToDecodingQtQuick"></a>
|
<a name="howToDecodingQtQuick"></a>
|
||||||
### Qt Quick
|
|
||||||
|
### Qt Quick
|
||||||
|
|
||||||
First register QZXing type to the QML engine.
|
First register QZXing type to the QML engine.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
#include "QZXing.h"
|
#include "QZXing.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
...
|
...
|
||||||
QZXing::registerQMLTypes();
|
QZXing::registerQMLTypes();
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The in the QML file
|
The in the QML file
|
||||||
|
|
||||||
```qml
|
```qml
|
||||||
import QZXing 2.3
|
import QZXing 2.3
|
||||||
|
@ -166,11 +189,12 @@ QZXing{
|
||||||
onDecodingFinished: console.log("Decoding finished " + (succeeded==true ? "successfully" : "unsuccessfully") )
|
onDecodingFinished: console.log("Decoding finished " + (succeeded==true ? "successfully" : "unsuccessfully") )
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="howToEncoding"></a>
|
|
||||||
## Encoding operation
|
|
||||||
|
|
||||||
To begin with, make sure the Encoder feature is enabled. If __QZXing.pri__ is used, then the feature is already enabled. If your project uses __QZXing-compoents.pri__ instead, do add the following CONFIG in your .pro file:
|
<a name="howToEncoding"></a>
|
||||||
|
|
||||||
|
## Encoding operation
|
||||||
|
|
||||||
|
To begin with, make sure the Encoder feature is enabled. If **QZXing.pri** is used, then the feature is already enabled. If your project uses **QZXing-compoents.pri** instead, do add the following CONFIG in your .pro file:
|
||||||
|
|
||||||
```pro
|
```pro
|
||||||
CONFIG += enable_encoder_qr_code
|
CONFIG += enable_encoder_qr_code
|
||||||
|
@ -179,24 +203,25 @@ include(QZXing/QZXing-components.pri)
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="howToEncodingCPP"></a>
|
<a name="howToEncodingCPP"></a>
|
||||||
### C++/Qt
|
|
||||||
|
|
||||||
The encoding function has been written as static as it does not have any dependencies to data other than the ones provided by the arguments.
|
### C++/Qt
|
||||||
|
|
||||||
Use the encoding function with its default settings:
|
The encoding function has been written as static as it does not have any dependencies to data other than the ones provided by the arguments.
|
||||||
|
|
||||||
* Format: QR Code
|
Use the encoding function with its default settings:
|
||||||
* Size: 240x240
|
|
||||||
* Error Correction Level: Low (L)
|
- Format: QR Code
|
||||||
|
- Size: 240x240
|
||||||
|
- Error Correction Level: Low (L)
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
#include "QZXing.h"
|
#include "QZXing.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
QString data = "text to be encoded";
|
QString data = "text to be encoded";
|
||||||
QImage barcode = QZXing::encodeData(data);
|
QImage barcode = QZXing::encodeData(data);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Or use the encoding function with custom settings:
|
Or use the encoding function with custom settings:
|
||||||
|
@ -208,11 +233,12 @@ QImage barcode = QZXing::encodeData(data, QZXing::EncoderFormat_QR_CODE,
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="howToEncodingQtQuick"></a>
|
<a name="howToEncodingQtQuick"></a>
|
||||||
### Qt Quick
|
|
||||||
|
|
||||||
The encoding function can be easily used in QML through QZXing's Image Provider: "image://QZXing/encode/<data_to_be_encoded>". As with the C++ example, it can either be used with the default settings or with custom settings.
|
### Qt Quick
|
||||||
|
|
||||||
First register the custom Image Provider in the __main.cpp__:
|
The encoding function can be easily used in QML through QZXing's Image Provider: "image://QZXing/encode/<data_to_be_encoded>". As with the C++ example, it can either be used with the default settings or with custom settings.
|
||||||
|
|
||||||
|
First register the custom Image Provider in the **main.cpp**:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
|
@ -240,7 +266,7 @@ Image{
|
||||||
Or use the encoding function with the optional custom settings that are passed like URL query parameters:
|
Or use the encoding function with the optional custom settings that are passed like URL query parameters:
|
||||||
|
|
||||||
| attribute name | value | description |
|
| attribute name | value | description |
|
||||||
| --------------- | ---------- | --------------------------------------------- |
|
| --------------- | ----------- | --------------------------------------------- |
|
||||||
| border | true, false | image has border (white 1px) |
|
| border | true, false | image has border (white 1px) |
|
||||||
| correctionLevel | L, M, Q, H | the error correction level |
|
| correctionLevel | L, M, Q, H | the error correction level |
|
||||||
| format | qrcode | the encode formatter. Currently only QR Code. |
|
| format | qrcode | the encode formatter. Currently only QR Code. |
|
||||||
|
@ -266,12 +292,16 @@ Image{
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="howToEncodingFormatExamples"></a>
|
<a name="howToEncodingFormatExamples"></a>
|
||||||
|
|
||||||
### Encoded text format Information
|
### Encoded text format Information
|
||||||
Here is a list of contents that have been encoded and tested to be recognizable by the Android ZXing decoding application:
|
|
||||||
|
Here is a list of contents that have been encoded and tested to be recognizable by the Android ZXing decoding application:
|
||||||
[QR Code encoding wiki page](https://github.com/ftylitak/qzxing/wiki/QR-Code-encoding)
|
[QR Code encoding wiki page](https://github.com/ftylitak/qzxing/wiki/QR-Code-encoding)
|
||||||
|
|
||||||
<a name="unitTestDependency"></a>
|
<a name="unitTestDependency"></a>
|
||||||
|
|
||||||
# Unit test dependency
|
# Unit test dependency
|
||||||
|
|
||||||
In order to run Unit tests in /test folder, the git submodule containing the test resoucres needs to be initialized and/or updated:
|
In order to run Unit tests in /test folder, the git submodule containing the test resoucres needs to be initialized and/or updated:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -279,6 +309,29 @@ cd qzxing
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<a name="#qt6limitations"></a>
|
||||||
|
|
||||||
|
# Qt 6 limitations
|
||||||
|
|
||||||
|
On Qt 6, a number of modules have been removed or not yet supported. The [list of removed modules](https://doc.qt.io/qt-6/whatsnew60.html#removed-modules-in-qt-6-0)
|
||||||
|
includes two important features that directly affect QZXing:
|
||||||
|
|
||||||
|
## Text codecs
|
||||||
|
|
||||||
|
QZXing used [QTextCodec](https://doc.qt.io/qt-6/qtextcodec.html) to re-interpret the parsed strings into their proper encoding. In Qt6, QTextCodec has been moved to **core5compat** module.
|
||||||
|
After testing, it seems that QTextCodec, if used through core5compat in Qt 6, it does not support many of the encoding that it did in Qt 5 (for instance, Shift-JIS encoding).
|
||||||
|
To avoid the dependency of an extra module (that also does not work as supposed to), QTextCodec has been replaced by [QStringDecoder](https://doc.qt.io/qt-6/qstringdecoder.html) only when building for Qt 6.
|
||||||
|
If QZXing if build for Qt 5, QTextCodec is used as it was.
|
||||||
|
|
||||||
|
## Multimedia (Video / Camera)
|
||||||
|
|
||||||
|
Qt Multimedia modules that includes the Camera item for QML and Video related operations for frame manipulation and live decoding are not supported in Qt 6 for the moment.
|
||||||
|
To my knowledge, there is no specific replacement for this absent modules and I hope they get re-supported for Qt 6.
|
||||||
|
|
||||||
|
Thus, if building for Qt 5, everything works fine. If trying to used **qzxing_multimedia** configuration in your **pro** file, the project will fail (example: [QZXingLive](https://github.com/ftylitak/qzxing/tree/master/examples/QZXingLive) project).
|
||||||
|
|
||||||
<a name="contact"></a>
|
<a name="contact"></a>
|
||||||
# Contact
|
|
||||||
|
# Contact
|
||||||
|
|
||||||
In case of bug reports or feature requests feel free to open an [issue](https://github.com/ftylitak/qzxing/issues).
|
In case of bug reports or feature requests feel free to open an [issue](https://github.com/ftylitak/qzxing/issues).
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
Supported only for Qt 5 projects since Qt Multimedia module has been removed in Qt 6.
|
||||||
|
|
||||||
|
In case it gets re-supported for Qt 6, the examples will be updated.
|
Loading…
Reference in New Issue