当前位置: 首页>>代码示例>>C++>>正文


C++ ListView::dataModel方法代码示例

本文整理汇总了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();
			}
		}
	}
}
开发者ID:theclabs,项目名称:BB10-MC-VISA-NFC,代码行数:55,代码来源:MainMenu.cpp

示例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);
        }
    }
}
开发者ID:drkillinger,项目名称:Cascades-Samples,代码行数:16,代码来源:stampcollectorapp.cpp

示例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();
			}
		}
	}
}
开发者ID:BBKeeper,项目名称:Cascades-Community-Samples,代码行数:87,代码来源:MainMenu.cpp


注:本文中的ListView::dataModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。