Note that there are some explanatory texts on larger screens.

plurals
  1. POAdd elements to Drop down bb 10 cascades
    primarykey
    data
    text
    <p>i have a Drop down in Qml file like...</p> <pre><code> DropDown { enabled: true // text only Option { text: "EUR/USD" } } </code></pre> <p>and my Database base read function is like... QList DatabaseOperations::readRecords(QString tableName){</p> <pre><code>QList&lt;QString&gt; 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. sym_ID_List.insert(recordsRead,query.value(1).toString()); recordsRead++; } qDebug() &lt;&lt; "Read " &lt;&lt; recordsRead &lt;&lt; " 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 database.close(); return sym_ID_List; </code></pre> <p>}</p> <p>once...this method ie Executed, It returns all the Symbol Id's in an "Qlist". now my Question is how to Add these "Qlist" elements dynamiccaly into Drop Down?</p> <p>How to achive it,</p> <p>Thanks,</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload