qr-codeblackberry-10

Generate QR-Code using Blackberry 10 BarcodeGenerator API


I am looking for code snip to generate QR-Code using Blackberry 10 BarcodeGenerator API.

Code snip is missing in API doc BarcodeGenerator

EDIT
As I am trying to using the API like below,

BarcodeGenerator barcodeGenerator;
bb::ImageData  imageData = barcodeGenerator.generate(BarcodeFormat::QrCode , "Generate QR-code");
imageView->setImage(Image(imageData));

it simply saying API is protected. Getting below error message,

C:/bbndk/target_10_3_1_995/qnx6/usr/include/bb/cascades/multimedia/BarcodeGenerator.hpp:158:31: error: 'bb::ImageData bb::cascades::multimedia::BarcodeGenerator::generate(int, const QString&)' is protected ../src/applicationui.cpp:46:73: error: within this context

EDIT 2
I extend the class BarcodeGenerator instead QObject and the QR code generated successfully.


Solution

  • You don't need code snippet, there's only one method to call to generate a bar code. As it is a Q_INVOKABLE method, it can be called by your QML too.

    Just tell us where you're stuck and what you have tried and we'll be able to help.