Commit 1e8ecbf2 authored by Volker Krause's avatar Volker Krause
Browse files

Expose barcode search without aspect ratio heuristics to JS

parent e3ad226a
Pipeline #61949 passed with stages
in 12 minutes and 22 seconds
......@@ -89,6 +89,15 @@ QString JsApi::Barcode::decodeDataMatrix(const QVariant &img) const
return {};
}
QString JsApi::Barcode::decodeAnyBarcode(const QVariant& img) const
{
if (img.userType() == qMetaTypeId<PdfImage>()) {
const auto pdfImg = img.value<PdfImage>();
return m_decoder->decodeString(pdfImg.image(), BarcodeDecoder::Any | BarcodeDecoder::IgnoreAspectRatio);
}
return {};
}
QVariant JsApi::Barcode::decodeUic9183(const QVariant &s) const
{
Uic9183Parser p;
......
......@@ -41,6 +41,12 @@ public:
* @param img An image containing the barcode, e.g. a PdfImage instance.
*/
Q_INVOKABLE QString decodeDataMatrix(const QVariant &img) const;
/** Attempts to decode any barcode found in the given image.
* This is the most expensive of the above option, and should only be
* used if no other alternative is available.
* @param img An image containing the barcode, e.g. a PdfImage instance.
*/
Q_INVOKABLE QString decodeAnyBarcode(const QVariant &img) const;
/** Decode an UIC 918.3 message from a train ticket Aztec code.
* @param s A QByteArray containing the raw data from the barcode.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment