main.cpp Example File
orientation/src/main.cpp
#include "OrientationSensor.hpp"
#include <bb/cascades/AbstractPane>
#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <QtCore/QLocale>
#include <QtCore/QTranslator>
using namespace bb::cascades;
Q_DECL_EXPORT int main(int argc, char **argv)
{
qmlRegisterUncreatableType<OrientationSensor>("Utils", 1, 0, "OrientationSensor", "Used for enums");
Application app(argc, argv);
QTranslator translator;
const QString locale_string = QLocale().name();
const QString filename = QString("orientation_%1").arg(locale_string);
if (translator.load(filename, "app/native/qm")) {
app.installTranslator(&translator);
}
OrientationSensor sensor;
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(&app);
qml->setContextProperty("_sensor", &sensor);
AbstractPane *appPage = qml->createRootObject<AbstractPane>();
Application::instance()->setScene(appPage);
return Application::exec();
}