Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Posts: 18
Registered: ‎07-24-2013
My Device: BLackberry 10
My Carrier: Mobile Apps developer

pushing values in to drop down after Navigation in BB 10 cascades

I have a Tabbed pane in bb 10 cascades and one of my Tab is like...in this link

http://pastebin.com/LRzyNdHZ (paste this link in address bar, if it doesn't open)

and As you observe ,in "Add/Delete Symbols" Action Item, I try to "AddOrDelete.qml" where I have a Drop down. you can find that "AddOrDelete.qml" in this link


now i have a method in "DatabaseOperations.cpp" like...

QList<QString>   DatabaseOperations::readRecords(QString tableName){

QList<QString> sym_ID_List;
  // 1. Get the local DB connection. Note, called database()
  //    Will automatically open a connection to the database
     QSqlDatabase database = QSqlDatabase::database(); // opens the default database.

  // 2. Create a query to search for the records
     QSqlQuery query(database);
     const QString sqlQuery = "SELECT * FROM "+tableName;

     if (query.exec(sqlQuery)) {

         // Get the field indexes. We know the order of the fields, and could skip this step.
         // However this will still work if the fi changeldse order in the query string.
         const int customerIDField = query.record().indexOf("SymbolId");

         // 3. Start navigating through the records by calling the 'next' function.
        //     When there are no longer any records it will return false.
         int recordsRead = 0;
         while (query.next()) {
             // 4. Access the data (stored in the query) via the field indexes
             //    and add the data to the model.

         qDebug() << "Read " << recordsRead << " records succeeded";
         if (recordsRead == 0) {
            // alert(tr("The customer table is empty."));
     } else {
        // alert(tr("Read records failed: %1").arg(query.lastError().text()));

     // 6. Optionally close the database connection if we no longer plan to use it
     return sym_ID_List;


now i would like to push these values in to drop down which is defined in "AddOrDelete.qml.

currently I am in Home Screen(i.e Tabbed pane with four Tabs... one of the tab is given in First link).I navigate to "AddOrDelete.qml" file From Action Item with Id : "Add/Delete Symbols".I have only one app.cpp file where I have Lode HomeScreen, like this..

ApplicationUI::ApplicationUI(bb::cascades::Application *app) : QObject(app){

qmlRegisterType < Timer > ("CustomTimer", 1, 0, "Timer");
QmlDocument *qml = QmlDocument::create("asset:///Template.qml").parent(this);
qml->setContextProperty("_app", this);
TabbedPane *root = qml->createRootObject<TabbedPane>();


For your Information, I did the navigation from Qml Itself. To push the Vaues from the DatabaseOpartion(), Do i need to Create a seperate .CPP for "AddOrDelete.qml". If so How Can i link "App.cpp" file and "second.cpp" file to navigate and how can i navigate to and from Home screen(Tabbed pane) to AddOrDelete screen in such a way that each CPP has seperate qml files . I have been faceing this problem since last week, I think i get a solution here,


Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: pushing values in to drop down after Navigation in BB 10 cascades

You've posted this in the wrong forum I've asked for it to be moved to the Native forum in Developer Support Forums.

If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.