main.cpp Example File
custombarcodescanner/src/main.cpp
#include "BarcodeDecoder.hpp"
#include "BarcodeScannerApp.hpp"
#include <bb/cascades/AbstractPane>
#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <QLocale>
#include <QTranslator>
using namespace bb::cascades;
Q_DECL_EXPORT int main(int argc, char **argv)
{
qmlRegisterType<bb::community::barcode::BarcodeDecoderControl>(
"bb.community.barcode", 1, 0, "BarcodeDecoder");
Application app(argc, argv);
QTranslator translator;
const QString filename = QString("barcodescanner_%1").arg(QLocale().name());
if (translator.load(filename, "app/native/qm")) {
app.installTranslator(&translator);
}
BarcodeScannerApp* barcodeScanner = new BarcodeScannerApp(&app);
QmlDocument *qml = QmlDocument::create("asset:///main.qml");
qml->setContextProperty("_barcodeScanner", barcodeScanner);
AbstractPane *root = qml->createRootObject<AbstractPane>();
Application::instance()->setScene(root);
return Application::exec();
}