本文整理汇总了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();
}
}
示例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);
}
示例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();
}
示例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();
}