main.cpp Example File
dialogs/src/main.cpp
#include <bb/cascades/AbstractPane>
#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/system/SystemCredentialsPrompt>
#include <bb/system/SystemDialog>
#include <bb/system/SystemPrompt>
#include <bb/system/SystemToast>
#include <bb/system/SystemUiButton>
#include <bb/system/SystemUiError>
#include <bb/system/SystemUiInputField>
#include <bb/system/SystemUiInputMode>
#include <bb/system/SystemUiPosition>
#include <bb/system/SystemUiResult>
#include <QLocale>
#include <QTranslator>
using namespace bb::cascades;
Q_DECL_EXPORT int main(int argc, char **argv)
{
qmlRegisterType<bb::system::SystemUiButton>("bb.system", 1, 0, "SystemUiButton");
qmlRegisterType<bb::system::SystemUiInputField>("bb.system", 1, 0, "SystemUiInputField");
qmlRegisterType<bb::system::SystemToast>("bb.system", 1, 0, "SystemToast");
qmlRegisterType<bb::system::SystemPrompt>("bb.system", 1, 0, "SystemPrompt");
qmlRegisterType<bb::system::SystemCredentialsPrompt>("bb.system", 1, 0, "SystemCredentialsPrompt");
qmlRegisterType<bb::system::SystemDialog>("bb.system", 1, 0, "SystemDialog");
qmlRegisterUncreatableType<bb::system::SystemUiError>("bb.system", 1, 0, "SystemUiError", "");
qmlRegisterUncreatableType<bb::system::SystemUiResult>("bb.system", 1, 0, "SystemUiResult", "");
qmlRegisterUncreatableType<bb::system::SystemUiPosition>("bb.system", 1, 0, "SystemUiPosition", "");
qmlRegisterUncreatableType<bb::system::SystemUiInputMode>("bb.system", 1, 0, "SystemUiInputMode", "");
qmlRegisterUncreatableType<bb::system::SystemUiModality>("bb.system", 1, 0, "SystemUiModality", "");
qRegisterMetaType<bb::system::SystemUiResult::Type>("bb::system::SystemUiResult::Type");
Application app(argc, argv);
QTranslator translator;
const QString locale_string = QLocale().name();
const QString filename = QString("dialogs_%1").arg(locale_string);
if (translator.load(filename, "app/native/qm")) {
app.installTranslator(&translator);
}
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(&app);
AbstractPane *appPage = qml->createRootObject<AbstractPane>();
Application::instance()->setScene(appPage);
return Application::exec();
}