QBarcode
Loading...
Searching...
No Matches
qbar::QrCode Class Reference

Represent a QrCode entity. More...

Inheritance diagram for qbar::QrCode:
Collaboration diagram for qbar::QrCode:

Public Member Functions

 QrCode ()
 Create an empty QrCode.
 
 QrCode (QrCode &&other) noexcept
 
QrCodeoperator= (QrCode &&) noexcept
 
QrLevelEcc getIdLevelEcc () const
 Retrieve QrCode ECC level.
 
int getVersion () const
 Retrieve QrCode version.
 
virtual QSizeF getRatio () const override
 Retrieve ratio of a barcode.
 
- Public Member Functions inherited from qbar::Barcode
 Barcode (Barcode &&other) noexcept
 
Barcodeoperator= (Barcode &&) noexcept
 
bool isValid () const
 Allow to verify if a barcode is valid.
 
BarType getType () const
 Get barcode type.
 
const PayloadgetPayload () const
 Get payload data of barcode.
 
QSize getSize () const
 Get matrix size.
 
const MatrixDatagetMatrixData () const
 Get matrix data of a barcode.
 
template<typename T >
const T * getPayloadAs () const
 Allow to directly cast payload to expected type.
 

Static Public Member Functions

static QrCode create (const Payload &payload, QrLevelEcc idLevel)
 Allow to generate a QrCode.
 

Static Public Attributes

static constexpr int VERSION_MIN = 1
 
static constexpr int VERSION_MAX = 40
 

Detailed Description

Represent a QrCode entity.

A QrCode entity is considered as immutable, use create() to generate one.
Once QrCode is generated, we can render it (to an image, widget, etc...) via class qbar::RendererQrCode.

See also
create()

Constructor & Destructor Documentation

◆ QrCode()

qbar::QrCode::QrCode ( )

Create an empty QrCode.

Initialized instance will be invalid.

See also
isValid()

Member Function Documentation

◆ getIdLevelEcc()

QrLevelEcc qbar::QrCode::getIdLevelEcc ( ) const

Retrieve QrCode ECC level.

Returns
Returns associated ECC level

◆ getVersion()

int qbar::QrCode::getVersion ( ) const

Retrieve QrCode version.

Returns
Returns associated version

◆ getRatio()

QSizeF qbar::QrCode::getRatio ( ) const
overridevirtual

Retrieve ratio of a barcode.

Allow to manage different format of barcode, to know if they are taller of wider.

Returns
Returns associated ratio.

Implements qbar::Barcode.

◆ create()

QrCode qbar::QrCode::create ( const Payload & payload,
QrLevelEcc idLevel )
static

Allow to generate a QrCode.

Generate a QrCode, version to use will be deduced according to the lenght of data to encode and the choosen ECC level.

Parameters
[in]payloadPayload content to use.
[in]idLevelECC level to use.
Returns
Returns generated QrCode.
It can be invalid, verify it via isValid() before using it.
See also
isValid()

Member Data Documentation

◆ VERSION_MIN

int qbar::QrCode::VERSION_MIN = 1
staticconstexpr

Minimal supported QrCode version (matrix of 21x21)

◆ VERSION_MAX

int qbar::QrCode::VERSION_MAX = 40
staticconstexpr

Maximal supported QrCode version (matrix of 177x177)


The documentation for this class was generated from the following files: