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


C++ DataItem::data方法代码示例

本文整理汇总了C++中DataItem::data方法的典型用法代码示例。如果您正苦于以下问题:C++ DataItem::data方法的具体用法?C++ DataItem::data怎么用?C++ DataItem::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataItem的用法示例。


在下文中一共展示了DataItem::data方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onFieldsReceived

void JAccountRegistrationPage::onFieldsReceived(const RegistrationData &data)
{
	ui->stackedWidget->setCurrentWidget(ui->formPage);
	if (data.form()) {
		DataForm::Ptr form = data.form();
		if (m_jabberForm) {
			DataForm::Ptr oldForm = m_jabberForm->getDataForm();
			for (uint i = 0; i < sizeof(knownVars) / sizeof(knownVars[0]); ++i) {
				QLatin1String var(knownVars[i]);
				Jreen::DataFormField oldField = oldForm->field(var);
				Jreen::DataFormField field = form->field(var);
				if (field.type() != Jreen::DataFormField::Invalid
						&& oldField.type() != Jreen::DataFormField::Invalid) {
					field.setValues(oldField.values());
				}
			}
			delete m_jabberForm;
		}
		
		m_jabberForm = new JDataForm(data.form(), data.bitsOfBinaries(), ui->formPage);
		m_form = m_jabberForm->widget();
		setSubTitle(data.form()->instructions());
		ui->verticalLayout_3->addWidget(m_jabberForm);
		
	} else {
//		if (data.hasUrl()) {
//			// Notify user about url by which he can register
//			QUrl url = data.url();
//		}
		if (data.hasFields()) {
			DataItem oldRoot;
			if (m_form)
				oldRoot = m_form->item();
			delete m_form;
			DataItem root;
			for (int i = 0; i < Jreen::RegistrationData::LastFieldType; ++i) {
				Jreen::RegistrationData::FieldType type = static_cast<Jreen::RegistrationData::FieldType>(i);
				if (!data.hasField(type))
					continue;
				QString name = QString::number(i);
				DataItem oldItem = root.subitem(name);
				DataItem item(name, fieldText(type), oldItem.data().toString());
				if (type == Jreen::RegistrationData::PasswordField)
					item.setProperty("password", true);
				item.setProperty("mandatory", true);
				root << item;
			}
			m_form = AbstractDataForm::get(root);
			setSubTitle(data.instructions());
			ui->verticalLayout_3->addWidget(m_form);
		}
	} 
	if (m_form) {
		connect(m_form, SIGNAL(completeChanged(bool)), SIGNAL(completeChanged()));
		emit completeChanged();
	}
}
开发者ID:AlexeyProkhin,项目名称:qutim,代码行数:57,代码来源:jaccountregistrationpage.cpp

示例2: data

QVariant KisPaintOpListModel::data(const QModelIndex& idx, int role) const
{
    if (!idx.isValid()) return QVariant();

    DataItem *item = categoriesMapper()->itemFromRow(idx.row());
    Q_ASSERT(item);

    if(role == Qt::DecorationRole) {
        if (!item->isCategory()) {
            return item->data()->icon;
        }
    } else if (role == SortRole) {
        return item->isCategory() ? item->name() :
            QString("%1%2%3")
            .arg(item->parentCategory()->name())
            .arg(item->data()->priority, 4)
            .arg(item->name());
    }

    return BasePaintOpCategorizedListModel::data(idx, role);
}
开发者ID:ChrisJong,项目名称:krita,代码行数:21,代码来源:kis_paint_ops_model.cpp

示例3: onSuccess

void JAccountRegistrationPage::onSuccess()
{
	ui->errorLabel->setText(QString());
	m_registered = true;
	if (m_jabberForm) {
		DataForm::Ptr form = m_jabberForm->getDataForm();
		DataFormField jidField = form->field(QLatin1String("username"));
		QString server = field(QLatin1String("server")).toString();
		JID jid = jidField.value() + QLatin1Char('@') + server;
		setField(QLatin1String("jid"), jid.bare());
		setField(QLatin1String("password"), QString());
		setField(QLatin1String("savePassword"), false);
	} else {
		DataItem item = m_form->item();
		DataItem jidItem = item.subitem(QString::number(Jreen::RegistrationData::UsernameField));
		QString server = field(QLatin1String("server")).toString();
		JID jid = jidItem.data().toString() + QLatin1Char('@') + server;
		setField(QLatin1String("jid"), jid.bare());
		setField(QLatin1String("password"), QString());
		setField(QLatin1String("savePassword"), false);
	}
	emit completeChanged();
	wizard()->next();
}
开发者ID:AlexeyProkhin,项目名称:qutim,代码行数:24,代码来源:jaccountregistrationpage.cpp

示例4: isItemEmpty

bool QuickContactInfo::isItemEmpty(const DataItem &item)
{
	if (item.data().isNull() || item.property("notSet", false))
		return true;
	QVariant::Type type = item.data().type();
	if (type == QVariant::Icon)
		return item.data().value<QIcon>().isNull();
	else if (type == QVariant::Pixmap)
		return item.data().value<QPixmap>().isNull();
	else if (type == QVariant::Image)
		return item.data().value<QImage>().isNull();
	else if (type == QVariant::StringList)
		return item.data().value<QStringList>().isEmpty();
	else if (item.data().canConvert<LocalizedString>())
		return item.data().value<LocalizedString>().toString().isEmpty();
	else if (item.data().canConvert<LocalizedStringList>())
		return item.data().value<LocalizedStringList>().isEmpty();
	else
		return item.data().toString().isEmpty();
}
开发者ID:AlexeyProkhin,项目名称:qutim,代码行数:20,代码来源:quickcontactinfo.cpp


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