Skip to content

legerch/QBarcode

Repository files navigation

QBarcode is a Qt library allowing to generate barcodes.

Tip

Latest development/pull requests will be committed into main branch.
Each stable release have their dedicated branch:

  • 1.0.x: branch dev/1.0
  • 1.1.x: branch dev/1.1
  • etc...

Table of contents :

1. Library details

1.1. Features

This cross platform library allow to generate multiple types of barcodes and render those in different format.
We have three "main" classes:

  • qbar::Payload: This class store only datas to use, representing what we have to encode.
  • qbar::Barcode: This is the base class of all barcodes types, responsible of building the barcode matrix. It don't manage encoding and don't manage appearance.
  • qbar::Renderer: This class allow to render barcodes (size, margins, colors, etc...) and only responsible of how does it look ?

Note

Custom application QBarcodeApp is available and used as a demo application to discover how this library can be used.

What types of barcodes are currently supported:

Type of barcode Barcode class Rendering class Supported payloads
QrCode qbar::QrCode qbar::RendererQrCode - String
- URL
- Wifi

Note

🕚 Currently planned: 🕚

  • More QrCode payload: geo, phone contact, etc...
  • More barcodes types: EAN-13

2. Requirements

2.1. C++ Standards

This library requires at least C++ 17 standard

2.2. Dependencies

Below, list of required dependencies:

Dependencies VCPKG package Comments
Qt / Compatible with Qt6.x
Compatible with Qt5.15.x
Google Test gtest Only needed to run unit-tests
libqrencode libqrencode /

Note

Dependency manager VCPKG is not mandatory, this is only a note to be able to list needed packages

3. How to build

3.1. CMake Usage

This library can be use as an embedded library in a subdirectory of your project (like a git submodule for example) :

  1. In the root CMakeLists, add instructions :
add_subdirectory(qbarcode) # Or if library is put in a folder "dependencies" : add_subdirectory(dependencies/qbarcode)
  1. In the application/library CMakeLists, add instructions :
# Link needed libraries
target_link_libraries(${PROJECT_NAME} PRIVATE qbarcode)

3.2. CMake options

This library provide some CMake build options:

  • QBAR_BUILD_TESTS (default: ON): Use to enable/disable unit-tests build

4. How to use

4.1. Usage

Please refer to the list of classes documentation for more details.

4.2. Library version

4.2.1. Compatibility

This library use the PImpl Idiom in order to preserve ABI compatibility (Qt wiki also have a great tutorial on the PImpl idiom).
So only major release (this project use the semantic versioning) should break the ABI.

4.2.2. Compilation time

In order to easily check at compilation time library version (to manage compatibility between multiple versions for example), macro QBAR_VERSION_ENCODE (defined inside library_global.h file) can be used:

#if QBAR_VERSION >= QBAR_VERSION_ENCODE(2,0,0)
    // Do stuff for version 2.0.0 or higher
#else
    // Do stuff for earlier versions
#endif

4.2.3. Runtime

Since library header used during final application build could differ from the actual library version, it is recommended to use the method:

#include "qbarcode/qbartypes.h"

const QVersionNumber libSemver = qbar::getLibraryVersion();

5. Documentation

All classes/methods has been documented with Doxygen utility and automatically generated at online website documentation.

Note

This repository contains two kinds of documentation:

  • Public API: Available via online website documentation or locally via Doxyfile docs/fragments/Doxyfile-public-api.in
  • Internal: Available locally only via docs/fragments/Doxyfile-internal.in

To generate documentation locally, we can use:

doxygen ./docs/fragments/Doxyfile-name

Tip

You can also load the Doxyfile into Doxywizard (Doxygen GUI) and run generation.

6. License

This library is licensed under MIT license.

About

QBarcode is a Qt library allowing to generate barcodes

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published