我在bb 10级联中有一个选项卡式窗格,其中一个选项卡就像...在此链接中
http://pastebin.com/LRzyNdHZ(在地址栏中粘贴此链接,如果它没有打开)
并且如您所见,在“添加/删除符号”操作项中,我尝试“AddOrDelete.qml”,其中我有一个Drop down。你可以在这个链接中找到“AddOrDelete.qml”
现在我在“DatabaseOperations.cpp”中有一个方法,比如......
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.
if(!query.value(1).toString().contains("skipRecord")){
//alert("recordsRead"+query.value(1).toString());
sym_ID_List.insert(recordsRead,query.value(1).toString());
}
recordsRead++;
}
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
database.close();
return sym_ID_List;
}
现在我想将这些值推入到“AddOrDelete.qml”中定义的下拉列表中。
目前我处于主屏幕(即带有四个选项卡的选项卡式窗格...其中一个选项卡在第一个链接中提供).I导航到“AddOrDelete.qml”文件来自具有Id的操作项:“添加/删除符号“。我只有一个app.cpp文件,我有Lode HomeScreen,就像这样...
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>();
app->setScene(root);
}
为了您的信息,我从Qml本身进行了导航。要从DatabaseOpartion()中推送Vaues,我是否需要为“AddOrDelete.qml”创建单独的.CPP。如果是这样我如何链接“App.cpp”文件和“second.cpp”文件。如何在主屏幕(选项卡式窗格)中导航和导航。自上周以来,我一直在面对这个问题,我想我在这里得到了解决方案,
感谢!!!