SCodes
SCodes copied to clipboard
This project is Qt & Qml wrapper for ZXing-C++ Library that is used for decoding 1D and 2D barcodes.
SCodes
This project is Qt & Qml wrapper for ZXing-C++ Library that is used for decoding and generating 1D and 2D barcodes. This particular C++ ZXing port is one of the most recent C++ versions of popular ZXing library using modern compilers.
The goal of this project was to create convenient filter allowing to process video frame from phone camera. Thanks to SCodes you can start scanning barcodes in few steps. We used Qt 5.15 to built both wrapper and example application, but it's compatible with older Qt versions as well. Feel free to read "How to scan barcodes in Qt Qml application" blog post if you are interested in the details behind scanning mechanism. This blog post contains step by step tutorial on how to do that.
SCodes supports generating barcodes as well. It is covered in "How to generate barcode in Qt Qml" application blog post.
Supported Formats
There are plenty of supported formats and we constantly work on adding new.
Supported 1D Formats
Format | Supports scanning | Supports generating |
---|---|---|
UPC-A | ||
UPC-E | ||
EAN-8 | ||
EAN-13 | ||
DataBar | ||
DataBar Expanded | ||
Code 39 | ||
Code 93 | ||
Code 128 | ||
Codabar | ||
ITF |
Supported 2D Formats
Format | Supports scanning | Supports generating |
---|---|---|
QR Code | ||
DataMatrix | ||
Aztec | ||
PDF417 | ||
MaxiCode |
How to use wrapper?
Using
QMake
All you need to do is to follow these steps.
- Add SCodes as submodule, by typing
git submodule add [email protected]:scythestudio/scodes.git
- Update submodule
git submodule update --recursive --init
(you can also put wrapper files to your project manually without adding submodule) - Add
include(scodes/src/SCodes.pri
to your .pro file - Import SCodes in your Qml file
import com.scythestudio.scodes 1.0
- Import multimedia module
import QtMultimedia 5.15
- If build fails, try to add
CONFIG += c++17
to your .pro file - You are done. Get inspired by QML Barcode Reader demo to test wrapper.
CMake
- Add SCodes as submodule, by typing
git submodule add [email protected]:scythestudio/scodes.git
- Update submodule
git submodule update --recursive --init
(you can also put wrapper files to your project manually without adding submodule) - Add to your project SCodes library
add_subdirectory(SCodes)
- Link SCodes library to your library or executable.
target_link_libraries(${PROJECT_NAME} PUBLIC SCodes)
- Import SCodes in your Qml file
import com.scythestudio.scodes 1.0
- You are done. Get inspired by QML Barcode Reader demo to test wrapper.
Trying various formats
SBarcodeFilter
is a class that you need to use for scanning case. By default it scans only specific basic formats of code (Code 39, Code 93, Code 128, QR Code and DataMatrix.).
The goal of that is to limit number of possible formats and improve performance.
To specify formats that should be accepted by the SBarcodeFilter
instance, you need to set it's format
property accordingly. This property allows setting multiple enum values as it's for flags. Add the following to your SBarcodeFilter
item in Qml code:
Component.onCompleted: {
barcodeFilter.format = SCodes.OneDCodes
}
See the enumeration values that represent supported formats in SBarcodeFormat.h
To accept all supported formats use SCodes.Any
.
Note
Both build systems have their examples located in same directory. All you need to do is to just open proper file(CMakeLists.txt or *.pro file) for different build system to be used.
Supported Kits for Examples
PROJECT | BUILD SYSTEM | WINDOWS-MinGW | WINDOWS-MSVC | LINUX-GCC | ANDROID |
---|---|---|---|---|---|
QmlBarcodeReader | qmake | ||||
QmlBarcodeGenerator | qmake | ||||
QmlBarcodeReader | cmake | ||||
QmlBarcodeGenerator | cmake |
To be able to build cmake based examples for android devices, you will need to set ANDROID_NDK environment variable in project build settings to NDK version 22 or greater(tested on NDK version 22.1.7171670).
About Scythe Studio
SCodes project was developed and is maintained mainly by Scythe Studio company. We are an official Qt Service Partner and a provider of Qt Software Development services including:
- Desktop applications development
- Mobile applications development
- Embedded systems development
- Qt and C++ consulting
- UI/UX designing
Do not hesitate visting https://scythe-studio.com to discover our capabilities and learn more about Qt Software Development from Scythe Studio Blog.