scytheStudio / SCodes

This project is Qt & Qml wrapper for ZXing-C++ Library that is used for decoding 1D and 2D barcodes.
https://scythe-studio.com/
Apache License 2.0
107 stars 36 forks source link

Documentation in README uses undefined values #22

Closed 1VanillaGorilla closed 7 months ago

1VanillaGorilla commented 1 year ago

Hey guys,

first of all: awesome tool you have created there!

Unfortunately there is a minor issue with your README file. You explain that to try various formats one just would have to add the following code:

Component.onCompleted: { barcodeFilter.format = SCodes.OneDCodes }

That may be correct but the namespace SCodes has not been exposed to QML anywhere. I've also checked the example QmlBarcodeReader and did not find any registration code for that namespace either.

The only thing one has to do to make that example work is to add the following lines:

qmlRegisterUncreatableMetaObject( SCodes::staticMetaObject, // meta object created by Q_NAMESPACE macro "SBarcodeFilter.scodes", // import statement (can be any string) 1, 0, // major and minor version of the import "SCodes", // name in QML (does not have to match C++ name) "Error: only enums" // error in case someone tries to create a MyNamespace object );

The name of the import statement is just an example of course and can be changed to your needs accordingly.

LeonnardoVerol commented 1 year ago
qmlRegisterUncreatableMetaObject(SCodes::staticMetaObject,    // meta object created by Q_NAMESPACE macro
                               "com.scythestudio.scodes",     // import statement (can be any string)
                               1, 0,                         // major and minor version of the import
                               "SCodes",                     // name in QML (does not have to match C++ name)
                               "Error: only enums"           // error in case someone tries to create a MyNamespace object
                               );