mirror of https://github.com/status-im/qzxing.git
Merge branch 'master' of https://github.com/ftylitak/qzxing
This commit is contained in:
commit
34fb8daa82
85
README.md
85
README.md
|
@ -25,68 +25,76 @@ Supports barcode decoding for the following types:
|
||||||
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. [Contact](#contact)
|
1. [Contact](#contact)
|
||||||
|
|
||||||
# How to include <a name="howToInclude"></a>
|
<a name="howToInclude"></a>
|
||||||
|
# How to include
|
||||||
|
|
||||||
The project can be used in two ways:
|
The project can be used in two ways:
|
||||||
## Embed the source code. <a name="embedInSourceCode"></a>
|
<a name="embedInSourceCode"></a>
|
||||||
|
## 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>
|
||||||
## Compile the project as an external library <a name="externalLibrary"></a>
|
## 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>
|
||||||
## Control dependencies <a name="controlDependencies"></a>
|
## 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:
|
||||||
|
|
||||||
### QZXing (core) <a name="controlDependenciesCore"></a>
|
<a name="controlDependenciesCore"></a>
|
||||||
|
### 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.
|
||||||
|
|
||||||
### QZXing (core + QML) <a name="controlDependenciesCoreQML"></a>
|
<a name="controlDependenciesCoreQML"></a>
|
||||||
|
### 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
|
||||||
```
|
```
|
||||||
|
|
||||||
### QZXing + QZXingFilter <a name="controlDependenciesCoreQMLQZXingFilter"></a>
|
<a name="controlDependenciesCoreQMLQZXingFilter"></a>
|
||||||
|
### 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).
|
||||||
|
|
||||||
## Decoding operation <a name="howToDecoding"></a>
|
<a name="howToDecoding"></a>
|
||||||
|
## Decoding operation
|
||||||
|
|
||||||
### C++/Qt <a name="howToDecodingCPP"></a>
|
<a name="howToDecodingCPP"></a>
|
||||||
|
### C++/Qt
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
#include <QZXing.h>
|
#include <QZXing.h>
|
||||||
|
@ -100,7 +108,8 @@ int main()
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Qt Quick <a name="howToDecodingQtQuick"></a>
|
<a name="howToDecodingQtQuick"></a>
|
||||||
|
### Qt Quick
|
||||||
|
|
||||||
First register QZXing type to the QML engine.
|
First register QZXing type to the QML engine.
|
||||||
|
|
||||||
|
@ -142,9 +151,11 @@ QZXing{
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Encoding operation <a name="howToEncoding"></a>
|
<a name="howToEncoding"></a>
|
||||||
|
## Encoding operation
|
||||||
|
|
||||||
### C++/Qt <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.
|
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.
|
||||||
|
|
||||||
|
@ -155,8 +166,13 @@ Use the encoding function with its default settings:
|
||||||
* Error Correction Level: Low (L)
|
* Error Correction Level: Low (L)
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
QString data = "text to be encoded";
|
#include <QZXing.h>
|
||||||
QImage barcode = QZXing::encodeData(data);
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
QString data = "text to be encoded";
|
||||||
|
QImage barcode = QZXing::encodeData(data);
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Or use the encoding function with custom settings:
|
Or use the encoding function with custom settings:
|
||||||
|
@ -167,13 +183,16 @@ QImage barcode = QZXing::encodeData(data, QZXing::EncoderFormat_QR_CODE,
|
||||||
QSize(width.toInt(), height.toInt()), QZXing::EncodeErrorCorrectionLevel_H);
|
QSize(width.toInt(), height.toInt()), QZXing::EncodeErrorCorrectionLevel_H);
|
||||||
```
|
```
|
||||||
|
|
||||||
### Qt Quick <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.
|
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.
|
||||||
|
|
||||||
Default settings:
|
Default settings:
|
||||||
|
|
||||||
```qml
|
```qml
|
||||||
|
import QZXing 2.3
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: inputField
|
id: inputField
|
||||||
text: "Hello world!"
|
text: "Hello world!"
|
||||||
|
@ -196,6 +215,8 @@ Or use the encoding function with custom settings that are passed like URL query
|
||||||
|
|
||||||
|
|
||||||
```qml
|
```qml
|
||||||
|
import QZXing 2.3
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: inputField
|
id: inputField
|
||||||
text: "Hello world!"
|
text: "Hello world!"
|
||||||
|
@ -211,5 +232,11 @@ Image{
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
# Contact <a name="contact"></a>
|
<a name="howToEncodingFormatExamples"></a>
|
||||||
|
### 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:
|
||||||
|
[QR Code encoding wiki page](https://github.com/ftylitak/qzxing/wiki/QR-Code-encoding)
|
||||||
|
|
||||||
|
<a name="contact"></a>
|
||||||
|
# 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).
|
||||||
|
|
Loading…
Reference in New Issue