StarshipSettingsApp::StarshipSettingsApp() { // Set the application organization and name, which is used by QSettings // when saving values to the persistent store. QCoreApplication::setOrganizationName("Example"); QCoreApplication::setApplicationName("Starship Settings"); // Localization: Make the initial call to set up the initial application language and // connect to the LocaleHandlers systemLanguaged change signal, this will // tell the application when it is time to load a new set of language strings. mTranslator = new QTranslator(this); mLocaleHandler = new LocaleHandler(this); onSystemLanguageChanged(); bool connectResult = connect(mLocaleHandler, SIGNAL(systemLanguageChanged()), SLOT(onSystemLanguageChanged())); Q_ASSERT(connectResult); Q_UNUSED(connectResult); // Then we load the application. QmlDocument *qml = QmlDocument::create("asset:///main.qml"); qml->setContextProperty("_starshipApp", this); if (!qml->hasErrors()) { AbstractPane *appPane = qml->createRootObject<AbstractPane>(); if (appPane) { Application::instance()->setScene(appPane); } } }
void WeatherGuesserApp::createCitiesPage() { QmlDocument *qml = QmlDocument::create().load("ContinentCitiesPage.qml"); if (!qml->hasErrors()) { mContinentCitiesPage = qml->createRootNode<Page>(); if (mContinentCitiesPage) { // Set up a cities model for the page, this model will load different cities depending // on which continent is selected. ListView *citiesList = mContinentCitiesPage->findChild<ListView*>("citiesList"); CityModel *cityModel = new CityModel(QStringList() << "name", "continents_connection", this); citiesList->setDataModel(cityModel); // Connect to the continents page custom signal. Page *continents = mNavigation->findChild<Page*>("continents"); connect(continents, SIGNAL(showContinentCities(QString)), cityModel, SLOT(onChangeContinent(QString))); qml->documentContext()->setContextProperty("_navigation", mNavigation); } } }
BucketListApp::BucketListApp() { // Set the application organization and name, which is used by QSettings // when saving values to the persistent store. QCoreApplication::setOrganizationName("Example"); QCoreApplication::setApplicationName("Bucket List Settings"); // The model for populating the bucket list is registered, so that it and all its // properties can be accessed directly from QML. This is done before creating the // QmlDocument below so that it is available when the corresponding QML component // is needed (see main.qml). qmlRegisterType<BucketModel>("com.bucketlist.bucketdata", 1, 0, "BucketModel"); // The application settings object used to store the BBM connection state qmlRegisterType<BucketSettings>("com.bucketlist.bucketdata", 1, 0, "BucketSettings"); // The BBM manager that can connect the application to BBM and update the BBM status message qmlRegisterType<BucketBBMManager>("com.bucketlist.bucketbbm", 1, 0, "BucketBBMManager"); // Create a QMLDocument and load it, using build patterns. QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this); if (!qml->hasErrors()) { AbstractPane *appPage = qml->createRootObject<AbstractPane>(); if (appPage) { // Set the main scene to the application Page. Application::instance()->setScene(appPage); } } }
WeatherGuesserApp::WeatherGuesserApp() { // Register QML types, so they can be used in QML. qmlRegisterType<SqlHeaderDataQueryEx>("bb.cascades.datamanager", 1, 2, "SqlHeaderDataQueryEx"); qmlRegisterType<PullToRefresh>("com.weather", 1, 0, "PullToRefresh"); qmlRegisterType<CityDataSource>("com.weather", 1, 0, "CityDataSource"); qmlRegisterType<LoadModelDecorator>("com.weather", 1, 0, "LoadModelDecorator"); qmlRegisterType<WeatherDataSource>("com.weather", 1, 0, "WeatherDataSource"); qmlRegisterUncreatableType<WeatherError>("com.weather", 1, 0, "WeatherError", "Uncreatable type"); // Prepare localization. Connect to the LocaleHandlers systemLanguaged change signal, this will // tell the application when it is time to load a new set of language strings. mTranslator = new QTranslator(this); mLocaleHandler = new LocaleHandler(this); onSystemLanguageChanged(); bool connectResult = connect(mLocaleHandler, SIGNAL(systemLanguageChanged()), SLOT(onSystemLanguageChanged())); Q_ASSERT(connectResult); Q_UNUSED(connectResult); // Create a QMLDocument and load it, using build patterns. QmlDocument *qmlDocument = QmlDocument::create("asset:///main.qml").parent(this); if (!qmlDocument->hasErrors()) { // Make the settings object available to QML qmlDocument->setContextProperty("_appSettings", new AppSettings(this)); // The application navigationPane is created from QML. AbstractPane *appPane = qmlDocument->createRootObject<AbstractPane>(); if (appPane) { // Set the main application scene to NavigationPane. Application::instance()->setScene(appPane); } } }
HelloForeignWindowApp::HelloForeignWindowApp() { mTvOn = false; mTvInitialized = false; // Here we create a QMLDocument and load the main UI QML file. QmlDocument *qml = QmlDocument::create().load("helloforeignwindow.qml"); if (!qml->hasErrors()) { // Set a context property for the QML to the application object, so that we // can call invokable functions in the app from QML. qml->setContextProperty("foreignWindowApp", this); // The application Page is created from QML. mAppPage = qml->createRootNode<Page>(); if (mAppPage) { Application::setScene(mAppPage); // Start the thread in which we render to the custom window. start(); } } }
void WeatherGuesserApp::createWeatherPage() { QmlDocument *qml = QmlDocument::create().load("WeatherPage.qml"); if (!qml->hasErrors()) { mWeatherPage = qml->createRootNode<Page>(); if (mWeatherPage) { // Set up a weather model the list, the model will load weather data ListView *weatherList = mWeatherPage->findChild<ListView*>("weatherList"); WeatherModel *weatherModel = new WeatherModel(this); weatherList->setDataModel(weatherModel); // Connect the weather model to page signals that updates city for which model should be shown. connect(mContinentCitiesPage, SIGNAL(showWeather(QString)), weatherModel, SLOT(onUpdateWeatherCity(QString))); Page *favorites = mNavigation->findChild<Page*>("favorites"); connect(favorites, SIGNAL(showWeather(QString)), weatherModel, SLOT(onUpdateWeatherCity(QString))); qml->documentContext()->setContextProperty("_navigation", mNavigation); } } }
millionSec::millionSec() { // Obtain a QMLDocument and load it into the qml variable, using build patterns. QmlDocument *qml = QmlDocument::create("asset:///second.qml"); qml->setParent(this); NavigationPane *nav = qml->createRootObject<NavigationPane>(); // If the QML document is valid, we process it. if (!qml->hasErrors()) { // Create the application Page from QMLDocument. //Page *appPage = qml->createRootObject<Page>(); if (nav) { // Set the main scene for the application to the Page. Application::instance()->setScene(nav); DropDown *day = DropDown::create(); int date = day->selectedIndex(); DropDown *month = DropDown::create(); month->add(Option::create().text("Jan")); month->add(Option::create().text("Feb")); } } }
PhotoBomberApp::PhotoBomberApp() { // We need to register the QML types in the multimedia-library, // otherwise we will get an error from the QML. qmlRegisterType < Camera > ("bb.cascades.multimedia", 1, 0, "Camera"); // Create a QMLDocument and load it, using build patterns QmlDocument *qml = QmlDocument::create("asset:///main.qml"); qml->setContextProperty("photoBomber", this); if (!qml->hasErrors()) { // The application Page is created from QML. Page *appPage = qml->createRootObject<Page>(); if (appPage) { // Set the application scene and connect the camera's shutterFired signal to our slot function Application::instance()->setScene(appPage); Camera *camera = appPage->findChild<Camera*>("myCamera"); QObject::connect(camera, SIGNAL(shutterFired()), this, SLOT(onShutterFired())); camera->open(CameraUnit::Front); } } }
HelloForeignWindowApp::HelloForeignWindowApp() { mTvOn = false; mTvInitialized = false; // Create a QML document and load the main UI QML file, using build patterns. QmlDocument *qml = QmlDocument::create("asset:///helloforeignwindow.qml"); if (!qml->hasErrors()) { // Set the context property we want to use from inside the QML document. Functions exposed // via Q_INVOKABLE will be found with this property and the name of the function. qml->setContextProperty("foreignWindowApp", this); // The application Page is created from QML. mAppPage = qml->createRootObject<Page>(); if (mAppPage) { Application::instance()->setScene(mAppPage); // Initialize the foreign window. initForeignWindow(); // Start the thread in which we render to the custom window. start(); } } }
StarshipSettingsApp::StarshipSettingsApp(QObject *parent) : QObject(parent) { // Localization: Make the initial call to set up the initial application language and // connect to the LocaleHandlers systemLanguaged change signal, this will // tell the application when it is time to load a new set of language strings. mTranslator = new QTranslator(this); mLocaleHandler = new LocaleHandler(this); onSystemLanguageChanged(); bool connectResult = connect(mLocaleHandler, SIGNAL(systemLanguageChanged()), SLOT(onSystemLanguageChanged())); Q_ASSERT(connectResult); Q_UNUSED(connectResult); // Then we load the application. QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this); if (!qml->hasErrors()) { // Make the application settings object available to QML, all application wide // settings are managed via properties in this object. qml->setContextProperty("appSettings", new AppSettings(this)); AbstractPane *appPane = qml->createRootObject<AbstractPane>(); if (appPane) { Application::instance()->setScene(appPane); } } }
KakelApp::KakelApp() { // Create and Load the QMLDocument, using build patterns. QmlDocument *qml = QmlDocument::create("asset:///main.qml"); if (!qml->hasErrors()) { setNumMoves(0); mNumTiles = 4; // Set the context property we want to use from inside the QML file. Functions exposed // via Q_INVOKABLE will be found with the property and the name of the function. qml->setContextProperty("kakel", this); // The application Page is created from the QML file. mAppPage = qml->createRootObject<Page>(); findPlayAreaAndInitialize(mAppPage); if (mAppPage) { // Finally the main scene for the application is set to the Page. Application::instance()->setScene(mAppPage); } } }
bool QuotesApp::loadQMLScene() { // Here we create a QML object and load it, we are using build patterns. QmlDocument *qmlDocument = QmlDocument::create().load("main.qml"); if (!qmlDocument->hasErrors()) { // In order to call invokable function in this object it is set as a context property. qmlDocument->setContextProperty("_quoteApp", this); // The root Container is created from QML. mNav = qmlDocument->createRootNode<NavigationPane>(); if (mNav) { // The list containing a bunch of people that have expressed clever things // when it comes to programming is set up. mListView = setUpQuotesList(); // Load the document for the Quotes page where content will be presented. QmlDocument *contentQML = QmlDocument::create().load("QuotePage/QuotePage.qml"); if (!contentQML->hasErrors()) { // Get the document context, it is used to bind a property for the ContentPane. // and make the navigation pane and application available for QML. mQmlContext = contentQML->documentContext(); mQmlContext->setContextProperty("_navPane", mNav); mQmlContext->setContextProperty("_quoteApp", this); // Initialization of the bound context properties of the content to empty strings. clearContentPaneData(); mContentPage = contentQML->createRootNode<Page>(); // Finally the main scene for the application is set to this Control. Application::setScene(mNav); return true; } } } return false; }
RetroArch::RetroArch() { qmlRegisterType<bb::cascades::pickers::FilePicker>("bb.cascades.pickers", 1, 0, "FilePicker"); qmlRegisterUncreatableType<bb::cascades::pickers::FileType>("bb.cascades.pickers", 1, 0, "FileType", ""); // Create channel to signal threads on chid = ChannelCreate(0); coid = ConnectAttach(0, 0, chid, _NTO_SIDE_CHANNEL, 0); bool res = connect( OrientationSupport::instance(), SIGNAL(rotationCompleted()), this, SLOT(onRotationCompleted())); rarch_main_clear_state(); strlcpy(g_extern.config_path, "app/native/retroarch.cfg", sizeof(g_extern.config_path)); config_load(); strlcpy(g_settings.libretro, "app/native/lib", sizeof(g_settings.libretro)); coreSelectedIndex = -1; //Stop config overwritting values g_extern.block_config_read = true; QmlDocument *qml = QmlDocument::create("asset:///main.qml"); if (!qml->hasErrors()) { qml->setContextProperty("RetroArch", this); AbstractPane *mAppPane = qml->createRootObject<AbstractPane>(); if (mAppPane) { //Get core DropDown reference to populate it in C++ coreSelection = mAppPane->findChild<DropDown*>("dropdown_core"); connect(coreSelection, SIGNAL(selectedValueChanged(QVariant)), this, SLOT(onCoreSelected(QVariant))); findCores(); Application::instance()->setScene(mAppPane); screen_create_context(&screen_ctx, 0); input_qnx.init(); buttonMap = new ButtonMap(screen_ctx, (const char*)Application::instance()->mainWindow()->groupId().toAscii().constData(), coid); deviceSelection = mAppPane->findChild<DropDown*>("dropdown_devices"); connect(deviceSelection, SIGNAL(selectedValueChanged(QVariant)), this, SLOT(onDeviceSelected(QVariant))); findDevices(); //Setup the datamodel for button mapping. mAppPane->findChild<ListView*>("buttonMapList")->setDataModel(buttonMap->buttonDataModel); // Start the thread in which we render to the custom window. start(); } } }
ApplicationUI::ApplicationUI(bb::cascades::Application *app) : QObject(app) { // prepare the localization m_pTranslator = new QTranslator(this); m_pLocaleHandler = new LocaleHandler(this); bool res = QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged())); // This is only available in Debug builds Q_ASSERT(res); // Since the variable is not used in the app, this is added to avoid a // compiler warning Q_UNUSED(res); // initial load onSystemLanguageChanged(); // Create scene document from main.qml asset, the parent is set // to ensure the document gets destroyed properly at shut down. QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this); qml->setContextProperty("_app", this); // Create root object for the UI AbstractPane *root = qml->createRootObject<AbstractPane>(); // Set created root object as the application scene app->setScene(root); // This is what was added as Active Frame initial setup QmlDocument *qmlCover = QmlDocument::create("asset:///cover/AppCover.qml").parent(this); if (!qmlCover->hasErrors()) { // Create the QML Container from using the QMLDocument. Container *coverContainer = qmlCover->createRootObject<Container>(); // Create a SceneCover and set the application cover SceneCover *sceneCover = SceneCover::create().content(coverContainer); Application::instance()->setCover(sceneCover); m_coverLabel = sceneCover->findChild<Label*>("m_coverLabel"); } // ************* // Initiate this variable iterator = 0; // Sets a 2 second timer timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(onTimerForActiveFrame())); timer->start(2000); // Call the Active Frame updater function right away onTimerForActiveFrame(); }
void RundGangApp::addApplicationCover() { // Create the Application Cover document from its QML file. QmlDocument *qmlCover = QmlDocument::create("asset:///Common/AppCover.qml").parent(this); if (!qmlCover->hasErrors()) { // Create the QML Container from using the QMLDocument. Container *coverContainer = qmlCover->createRootObject<Container>(); // Create a SceneCover and set the application cover SceneCover *sceneCover = SceneCover::create().content(coverContainer); Application::instance()->setCover(sceneCover); } }
void millionSec::addApplicationCover() { // A small UI consisting of just an ImageView in a Container is set up // and used as the cover for the application when running in minimized mode. QmlDocument *qmlCover = QmlDocument::create("asset:///minimized.qml").parent(this); if (!qmlCover->hasErrors()) { // Create the QML Container from using the QMLDocument. Container *coverContainer = qmlCover->createRootObject<Container>(); // Create a SceneCover and set the application cover SceneCover *sceneCover = SceneCover::create().content(coverContainer); Application::instance()->setCover(sceneCover); } }
Frontend::Frontend() { qmlRegisterType<bb::cascades::pickers::FilePicker>("bb.cascades.pickers", 1, 0, "FilePicker"); qmlRegisterUncreatableType<bb::cascades::pickers::FileType>("bb.cascades.pickers", 1, 0, "FileType", ""); qmlRegisterType<ImageLoader>(); mStartEmu = false; m_boxart = 0; m_running = false; check_profile(); toast = new SystemToast(this); toastButton = new SystemToast(this); memset(&m_controllers[0], 0, sizeof(Controller)); memset(&m_controllers[1], 0, sizeof(Controller)); //Set touchscreen as default m_controllers[0].device = 1; chid = ChannelCreate(0); coid = ConnectAttach(0, 0, chid, _NTO_SIDE_CHANNEL, 0); // Set the application organization and name, which is used by QSettings // when saving values to the persistent store. QCoreApplication::setOrganizationName("Example"); QCoreApplication::setApplicationName("PCSX-reARMed-BB"); //Load config from json file if(loadConfigFromJson(QString("shared/misc/pcsx-rearmed-bb/cfg/data.json")) == -1) { //QFile(QString("assets/data.json")).copy(QString("shared/misc/pcsx-rearmed-pb/cfg/data.json")); } // Then we load the application. QmlDocument *qml = QmlDocument::create("asset:///main.qml"); qml->setContextProperty("_frontend", this); if (!qml->hasErrors()) { TabbedPane *tab = qml->createRootObject<TabbedPane>(); if (tab) { mCheatsContainer = tab->findChild<Container*>("cheats"); Application::instance()->setScene(tab); start(); } } }
PoemMaker::PoemMaker() { // Here we create a QMLDocument and load it, we are using build patterns. QmlDocument *qml = QmlDocument::create().load("main.qml"); if (!qml->hasErrors()) { // An application Page is created from QML. Page *appPage = qml->createRootNode<Page>(); if (appPage) { // Finally the main scene for the application is set the Page. Application::setScene(appPage); } } }
PoemMaker::PoemMaker() { // Create a QMLDocument and load it with main.qml, using build patterns. QmlDocument *qml = QmlDocument::create("asset:///main.qml"); if (!qml->hasErrors()) { // An application Page is created from QML. Page *appPage = qml->createRootObject<Page>(); if (appPage) { // Finally the main scene for the application is set to the Page. Application::instance()->setScene(appPage); } } }
ApplicationUI::ApplicationUI() : QObject() { // prepare the localization m_pTranslator = new QTranslator(this); m_pLocaleHandler = new LocaleHandler(this); bool res = QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged())); // This is only available in Debug builds Q_ASSERT(res); // Since the variable is not used in the app, this is added to avoid a // compiler warning Q_UNUSED(res); // initial load onSystemLanguageChanged(); QCoreApplication::setOrganizationName("NicolasHan"); QCoreApplication::setApplicationName("NicoMeBB"); // Create scene document from main.qml asset, the parent is set // to ensure the document gets destroyed properly at shut down. QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this); qml->setContextProperty("nicomeApp", this); // Create root object for the UI AbstractPane *root = qml->createRootObject<AbstractPane>(); // Set created root object as the application scene Application::instance()->setScene(root); //cover QmlDocument *qmlCover = QmlDocument::create("asset:///AppCover.qml").parent(this); if (!qmlCover->hasErrors()) { qmlCover->setContextProperty("nicomeApp", this); // Create the QML Container from using the QMLDocument. Container *coverContainer = qmlCover->createRootObject<Container>(); // Create a SceneCover and set the application cover SceneCover *sceneCover = SceneCover::create().content(coverContainer); Application::instance()->setCover(sceneCover); } }
PhotoBomberApp::PhotoBomberApp() { // Create a QMLDocument and load it, using build patterns QmlDocument *qml = QmlDocument::create("asset:///main.qml"); qml->setContextProperty("_photoBomber", this); if (!qml->hasErrors()) { // The application Page is created from QML. Page *appPage = qml->createRootObject<Page>(); if (appPage) { // Set the application scene. Application::instance()->setScene(appPage); } } }
void ApplicationUI::onAboutActionTriggered() { QmlDocument *qml = QmlDocument::create("asset:///AboutPage.qml").parent(this); if(qml->hasErrors()) { return; } Page *aboutPage = qml->createRootObject<Page>(); qml->setParent(aboutPage); bb::ApplicationInfo appInfo; aboutPage->setProperty("appName", appInfo.title()); aboutPage->setProperty("versionNumber", appInfo.version()); Sheet *sheet = Sheet::create().content(aboutPage); connect(aboutPage, SIGNAL(close()), this, SLOT(onSheetPageClosed())); connect(aboutPage, SIGNAL(openUrl(QString)), this, SLOT(onOpenUrlInBrowser(QString))); sheet->open(); Application::instance()->setMenuEnabled(false); }
/** * This sample application shows how to combine QNetworkAccessManager and QXmlStreamReader * to download a RSS feed from the network and extracting the single article information from * it. * The user can define a feed URL in the UI and after clicking 'Fetch' button, the list of * articles will be shown. */ int main(int argc, char **argv) { Application app(argc, argv); // Create the business logic object RSSListing rssListing; QmlDocument *qml = QmlDocument::create("asset:///main.qml"); if (!qml->hasErrors()) { // Make the RSSListing object available to the UI as context property qml->setContextProperty("_rssListing", &rssListing); Page *appPage = qml->createRootObject<Page>(); if (appPage) { Application::instance()->setScene(appPage); } } return Application::exec(); }
WeatherGuesserApp::WeatherGuesserApp() { // We set up the application Organization and name, this is used by QSettings // when saving values to the persistent store, in this app the home page is kept in the settings. QCoreApplication::setOrganizationName("Example"); QCoreApplication::setApplicationName("Weather Guesser"); // Here we create a QMLDocument and load it, we are using build patterns. QmlDocument *qml = QmlDocument::create().load("main.qml"); qml->setParent(this); if (!qml->hasErrors()) { // The application navigationPane is created from QML. mNavigation = qml->createRootNode<NavigationPane>(); if (mNavigation) { // Create the cities and weather page, these are pages which is not part of the // NavigationPane, the application will handle navigation to these. createCitiesPage(); createWeatherPage(); // Set up the favorite and home page, load models and connects to the appropriate signals. setUpFavoritesPage(); setUpHomePage(); // Connect to custom signals that will trigger navigation, defined in QML. Page *continents = mNavigation->findChild<Page*>("continents"); connect(continents, SIGNAL(showContinentCities(QString)), this, SLOT(onShowContinentCities(QString))); Page *favorites = mNavigation->findChild<Page*>("favorites"); connect(favorites, SIGNAL(showWeather(QString)), this, SLOT(onShowWeather(QString))); connect(mContinentCitiesPage, SIGNAL(showWeather(QString)), this, SLOT(onShowWeather(QString))); // Finally the main scene for the application is set to NavigationPane. Application::setScene(mNavigation); } } }
ApplicationUI::ApplicationUI() { // create scene document from main.qml asset // set parent to created document to ensure it exists for the whole application lifetime QmlDocument *qml = QmlDocument::create("asset:///main.qml"); if (!qml->hasErrors()) { qml->setContextProperty("_app", this); // create root object for the UI _page = qml->createRootObject<Page>(); if (_page) { // set created root object as a scene Application::instance()->setScene(_page); runcocos2dx(); } } }
CircularSliderApp::CircularSliderApp() : QObject() { // Register our custom control qmlRegisterType<CircularSlider>("custom.lib", 1, 0, "CircularSlider"); QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this); // If the QML document is valid, we process it. if (!qml->hasErrors()) { // Create the application Page from QMLDocument. Page *appPage = qml->createRootObject<Page>(); if (appPage) { // Set the main scene for the application to the Page. Application::instance()->setScene(appPage); } } }
/** * The user can define a feed URL in the UI and after clicking 'Fetch' button, the weather * will be shown. */ Q_DECL_EXPORT int main(int argc, char **argv) { Application app(argc, argv); // Create the business logic object RSSFeed RSSFeed; QmlDocument *qml = QmlDocument::create("asset:///main.qml"); if (!qml->hasErrors()) { qml->setContextProperty("_RSSFeed", &RSSFeed); Page *appPage = qml->createRootObject<Page>(); if (appPage) { Application::instance()->setScene(appPage); } } return Application::exec(); }
void PgcRouterApp::loadForms() { m_formListModel = new FormListModel(this); m_formListModel->load(assetPath("model/" + m_appSettings->forms()->inboxFile())); // Obtain a QMLDocument and load it into the qml variable, using build patterns. QmlDocument *qml = QmlDocument::create("asset:///main.qml"); // If the QML document is valid, we process it. if (!qml->hasErrors()) { qml->setContextProperty("_formList", m_formListModel); // Create the application Page from QMLDocument. AbstractPane *root = qml->createRootObject<AbstractPane>(); if (root) { // Set the main scene for the application to the Page. Application::instance()->setScene(root); } } }
bool QuotesApp::loadQMLScene() { // Create a QML object and load it, using build patterns. QmlDocument *qmlDocument = QmlDocument::create("asset:///main.qml"); if (!qmlDocument->hasErrors()) { // In order to call invokable functions in this object, set the context property. qmlDocument->setContextProperty("_quoteApp", this); // The root Container is created from QML. NavigationPane* navigationPane = qmlDocument->createRootObject<NavigationPane>(); if (navigationPane) { // Load the quotes table from the database. QVariantList sqlData = mQuotesDbHelper->loadDataBase("quotes.db", "quotes"); if (!sqlData.isEmpty()) { // The list containing a bunch of people that have expressed clever things // when it comes to programming is set up. // A GroupDataModel is used for creating a sorted list, the sorting // properties are set in QML here the data is loaded. mDataModel = navigationPane->findChild<GroupDataModel*>("quotesModel"); mDataModel->insertList(sqlData); // The list view is set up in QML, here we retrieve it to be used // when updating the selected item in the deleteRecord funciton. mListView = navigationPane->findChild<ListView*>("quotesList"); } // Finally the main scene for the application is set to this Control. Application::instance()->setScene(navigationPane); return true; } } return false; }
RetroArch::RetroArch() { qmlRegisterType<bb::cascades::pickers::FilePicker>("bb.cascades.pickers", 1, 0, "FilePicker"); qmlRegisterUncreatableType<bb::cascades::pickers::FileType>("bb.cascades.pickers", 1, 0, "FileType", ""); // Create channel to signal threads on chid = ChannelCreate(0); coid = ConnectAttach(0, 0, chid, _NTO_SIDE_CHANNEL, 0); bool res = connect( OrientationSupport::instance(), SIGNAL(rotationCompleted()), this, SLOT(onRotationCompleted())); rarch_main_clear_state(); strlcpy(g_settings.libretro, "app/native/lib", sizeof(g_settings.libretro)); coreSelectedIndex = -1; QmlDocument *qml = QmlDocument::create("asset:///main.qml"); if (!qml->hasErrors()) { qml->setContextProperty("RetroArch", this); AbstractPane *mAppPane = qml->createRootObject<AbstractPane>(); if (mAppPane) { //Get core DropDown reference to populate it in C++ coreSelection = mAppPane->findChild<DropDown*>("dropdown_core"); connect(coreSelection, SIGNAL(selectedValueChanged(QVariant)), this, SLOT(onCoreSelected(QVariant))); findCores(); Application::instance()->setScene(mAppPane); // Start the thread in which we render to the custom window. start(); } } }