本文整理汇总了C++中ListView::dataModel方法的典型用法代码示例。如果您正苦于以下问题:C++ ListView::dataModel方法的具体用法?C++ ListView::dataModel怎么用?C++ ListView::dataModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListView
的用法示例。
在下文中一共展示了ListView::dataModel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onListSelectionChanged
void MainMenu::onListSelectionChanged(const QVariantList indexPath) {
if (sender()) {
ListView* menuList = dynamic_cast<ListView*>(sender());
DataModel* menuModel = menuList->dataModel();
QVariantMap map = menuModel->data(indexPath).toMap();
if (map["itemName"].canConvert(QVariant::String)) {
QString item = map["itemName"].toString();
qDebug() << "XXXX selected item name=" << item;
if (item.compare("item_read") == 0) {
qDebug() << "XXXX Read Tag was selected!";
StateManager* state_mgr = StateManager::getInstance();
state_mgr->setEventLogShowing(true);
_eventLog->setMessage("Bring a tag close");
emit read_selected();
} else if (item.compare("item_uri") == 0) {
qDebug() << "XXXX Write URI was selected!";
emit write_uri();
} else if (item.compare("item_sp") == 0) {
qDebug() << "XXXX Write SP was selected!";
emit write_sp();
} else if (item.compare("item_text") == 0) {
qDebug() << "XXXX Write Text was selected!";
emit write_text();
} else if (item.compare("item_custom") == 0) {
qDebug() << "XXXX Write Custom was selected!";
emit write_custom();
} else if (item.compare("item_about") == 0) {
qDebug() << "XXXX About was selected!";
emit about_selected();
} else if (item.compare("item_snep_vcard") == 0) {
qDebug() << "XXXX Send vCard (SNEP) was selected!";
emit send_vcard_selected();
} else if (item.compare("item_emulate_tag") == 0) {
qDebug() << "XXXX Emulate Tag was selected!";
emit emulate_tag_selected();
} else if (item.compare("item_iso7816") == 0) {
qDebug() << "XXXX ISO7816 APDU was selected!";
StateManager* state_mgr = StateManager::getInstance();
state_mgr->setEventLogShowing(true);
emit iso7816_selected();
}
}
}
}
示例2: onSelectionChanged
void StampCollectorApp::onSelectionChanged(const QVariantList indexPath, bool selected)
{
if (selected) {
// We use the sender to get the list view for accessing the data model and then the actual data.
if(sender()) {
ListView* stampList = dynamic_cast<ListView*>(sender());
DataModel* stampModel = stampList->dataModel();
// Update the content view context property so that it corresponds to
// the selected item and navigate to the page.
QVariantMap map = stampModel->data(indexPath).toMap();
mQmlContext->setContextProperty("_contentView", map);
mNav->push(mContentPage);
}
}
}
示例3: onListSelectionChanged
void MainMenu::onListSelectionChanged(const QVariantList indexPath) {
if (sender()) {
ListView* menuList = dynamic_cast<ListView*>(sender());
DataModel* menuModel = menuList->dataModel();
QVariantMap map = menuModel->data(indexPath).toMap();
if (map["itemName"].canConvert(QVariant::String)) {
QString item = map["itemName"].toString();
qDebug() << "XXXX selected item name=" << item;
if (item.compare("item_read") == 0) {
qDebug() << "XXXX Read Tag was selected!";
StateManager* state_mgr = StateManager::getInstance();
state_mgr->setEventLogShowing(true);
_eventLog->setMessage("Bring a tag close");
emit read_selected();
} else if (item.compare("item_tag_details") == 0) {
qDebug() << "XXXX Tag Details was selected!";
emit tag_details_selected();
} else if (item.compare("item_uri") == 0) {
qDebug() << "XXXX Write URI was selected!";
QObject::connect(_eventLog, SIGNAL(back()), _writeURI, SLOT(backFromEventLog()));
emit write_uri();
} else if (item.compare("item_sp") == 0) {
qDebug() << "XXXX Write SP was selected!";
QObject::connect(_eventLog, SIGNAL(back()), _writeSp, SLOT(backFromEventLog()));
emit write_sp();
} else if (item.compare("item_text") == 0) {
qDebug() << "XXXX Write Text was selected!";
QObject::connect(_eventLog, SIGNAL(back()), _writeText, SLOT(backFromEventLog()));
emit write_text();
} else if (item.compare("item_custom") == 0) {
qDebug() << "XXXX Write Custom was selected!";
QObject::connect(_eventLog, SIGNAL(back()), _writeCustom, SLOT(backFromEventLog()));
emit write_custom();
} else if (item.compare("item_about") == 0) {
qDebug() << "XXXX About was selected!";
emit about_selected();
} else if (item.compare("item_snep_vcard") == 0) {
qDebug() << "XXXX Send vCard (SNEP) was selected!";
QObject::connect(_eventLog, SIGNAL(back()), _sendVcard, SLOT(backFromEventLog()));
emit send_vcard_selected();
} else if (item.compare("item_emulate_tag") == 0) {
qDebug() << "XXXX Emulate Tag was selected!";
QObject::connect(_eventLog, SIGNAL(back()), _emulateSp, SLOT(backFromEventLog()));
emit emulate_tag_selected();
} else if (item.compare("item_emulate_echo") == 0) {
qDebug() << "XXXX Emulate Echo was selected!";
StateManager* state_mgr = StateManager::getInstance();
state_mgr->setEventLogShowing(true);
_eventLog->setMessage("Place BlackBerry on reader");
emit emulate_echo_selected();
} else if (item.compare("item_iso7816") == 0) {
qDebug() << "XXXX ISO7816 APDU was selected!";
StateManager* state_mgr = StateManager::getInstance();
state_mgr->setEventLogShowing(true);
QObject::connect(_eventLog, SIGNAL(back()), _apduDetails, SLOT(backFromEventLog()));
emit iso7816_selected();
} else if (item.compare("item_read_iso15693") == 0) {
qDebug() << "XXXX Read ISO15693 was selected!";
StateManager* state_mgr = StateManager::getInstance();
state_mgr->setEventLogShowing(false);
emit readIso15693_selected();
} else if (item.compare("item_write_iso15693") == 0) {
qDebug() << "XXXX Write ISO15693 was selected!";
StateManager* state_mgr = StateManager::getInstance();
state_mgr->setEventLogShowing(false);
emit writeIso15693_selected();
} else if (item.compare("item_read_gvb") == 0) {
qDebug() << "XXXX Read GVB was selected!";
StateManager* state_mgr = StateManager::getInstance();
state_mgr->setEventLogShowing(false);
emit readGvb_selected();
}
}
}
}