本文整理汇总了C++中QContactDetailDefinition::fields方法的典型用法代码示例。如果您正苦于以下问题:C++ QContactDetailDefinition::fields方法的具体用法?C++ QContactDetailDefinition::fields怎么用?C++ QContactDetailDefinition::fields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QContactDetailDefinition
的用法示例。
在下文中一共展示了QContactDetailDefinition::fields方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: detailDefinitions
/*!
* Modifies the detail definitions. The default detail definitions are
* queried from QContactManagerEngine::schemaDefinitions and then modified
* with this function in the transform leaf classes.
*
* \a definitions The detail definitions to modify.
* \a contactType The contact type the definitions apply for.
*/
void CntTransformOnlineAccount::detailDefinitions(QMap<QString, QContactDetailDefinition> &definitions, const QString& contactType) const
{
Q_UNUSED(contactType);
if(definitions.contains(QContactOnlineAccount::DefinitionName)) {
QContactDetailDefinition d = definitions.value(QContactOnlineAccount::DefinitionName);
QMap<QString, QContactDetailFieldDefinition> fields = d.fields();
QContactDetailFieldDefinition f;
// Support only certain subtypes
f.setDataType(QVariant::StringList);
QVariantList subTypes;
subTypes << QString(QLatin1String(QContactOnlineAccount::SubTypeSip));
subTypes << QString(QLatin1String(QContactOnlineAccount::SubTypeSipVoip));
subTypes << QString(QLatin1String(QContactOnlineAccount::SubTypeImpp));
subTypes << QString(QLatin1String(QContactOnlineAccount::SubTypeVideoShare));
f.setAllowableValues(subTypes);
fields[QContactOnlineAccount::FieldSubTypes] = f;
// Don't support "ContextOther"
f.setDataType(QVariant::StringList);
f.setAllowableValues(QVariantList()
<< QLatin1String(QContactDetail::ContextHome)
<< QLatin1String(QContactDetail::ContextWork));
fields[QContactDetail::FieldContext] = f;
d.setFields(fields);
// Replace original definitions
definitions.insert(d.name(), d);
}
}
示例2: detailDefinitions
/*!
* Modifies the detail definitions. The default detail definitions are
* queried from QContactManagerEngine::schemaDefinitions and then modified
* with this function in the transform leaf classes.
*
* \a definitions The detail definitions to modify.
* \a contactType The contact type the definitions apply for.
*/
void CntTransformAnniversarySimple::detailDefinitions(QMap<QString, QContactDetailDefinition> &definitions, const QString& contactType) const
{
Q_UNUSED(contactType);
if(definitions.contains(QContactAnniversary::DefinitionName)) {
QContactDetailDefinition d = definitions.value(QContactAnniversary::DefinitionName);
QMap<QString, QContactDetailFieldDefinition> fields = d.fields();
// Following fields not supported in symbian (pre-10.1) back-end, remove
fields.remove(QContactAnniversary::FieldCalendarId);
fields.remove(QContactAnniversary::FieldEvent);
// Sub-types not supported in symbian back-end, remove
fields.remove(QContactAnniversary::FieldSubType);
// Context not supported in symbian back-end, remove
fields.remove(QContactAnniversary::FieldContext);
d.setFields(fields);
d.setUnique(true);
// Replace original definitions
definitions.insert(d.name(), d);
}
}
示例3: detailDefinitions
/*!
* Modifies the detail definitions. The default detail definitions are
* queried from QContactManagerEngine::schemaDefinitions and then modified
* with this function in the transform leaf classes.
*
* \a definitions The detail definitions to modify.
* \a contactType The contact type the definitions apply for.
*/
void CntTransformOnlineAccount::detailDefinitions(QMap<QString, QContactDetailDefinition> &definitions, const QString& contactType) const
{
Q_UNUSED(contactType);
if(definitions.contains(QContactOnlineAccount::DefinitionName)) {
QContactDetailDefinition d = definitions.value(QContactOnlineAccount::DefinitionName);
QMap<QString, QContactDetailFieldDefinition> fields = d.fields();
QContactDetailFieldDefinition f;
// Not all fields are supported
fields.remove(QContactOnlineAccount::FieldCapabilities);
fields.remove(QContactOnlineAccount::FieldDetailUri);
fields.remove(QContactOnlineAccount::FieldLinkedDetailUris);
fields.remove(QContactOnlineAccount::FieldServiceProvider);
fields.remove(QContactOnlineAccount::FieldContext);
// Support only certain subtypes
f.setDataType(QVariant::StringList);
QVariantList subTypes;
subTypes << QString(QLatin1String(QContactOnlineAccount::SubTypeSip));
subTypes << QString(QLatin1String(QContactOnlineAccount::SubTypeSipVoip));
subTypes << QString(QLatin1String(QContactOnlineAccount::SubTypeVideoShare));
f.setAllowableValues(subTypes);
fields[QContactOnlineAccount::FieldSubTypes] = f;
d.setFields(fields);
// Replace original definitions
definitions.insert(d.name(), d);
}
}
示例4: qDebug
void MainWindow::on_pushButton_3_clicked()
{
// qDebug() << "The default manager for the platform is:" << cm.managerName();
// qDebug() << "It" << (cm.isRelationshipTypeSupported(QContactRelationship::HasAssistant) ? "supports" : "does not support") << "assistant relationships.";
// qDebug() << "It" << (cm.supportedContactTypes().contains(QContactType::TypeGroup) ? "supports" : "does not support") << "groups.";
// qDebug() << "It" << (cm.hasFeature(QContactManager::MutableDefinitions) ? "supports" : "does not support") << "mutable detail definitions.";
QList<QContactLocalId> contactIds = cm.contactIds();
QContact a = cm.contact(contactIds.first());
qDebug() << "Viewing the details of" << a.displayLabel();
QList<QContactDetail> allDetails = a.details();
for (int i = 0; i < allDetails.size(); i++) {
QContactDetail detail = allDetails.at(i);
QContactDetailDefinition currentDefinition = cm.detailDefinition(detail.definitionName());
QMap<QString, QContactDetailFieldDefinition> fields = currentDefinition.fields();
qDebug("\tDetail #%d (%s):", i, detail.definitionName().toAscii().constData());
foreach (const QString& fieldKey, fields.keys()) {
qDebug() << "\t\t" << fieldKey << "(" << fields.value(fieldKey).dataType() << ") =" << detail.value(fieldKey);
}
qDebug();
}
QContact b;
QContactDetail de;
foreach (const QContactLocalId& ids, contactIds )
{
b = cm.contact(ids);
de = b.detail("PhoneNumber");
bool s = de.hasValue("PhoneNumber");
qDebug()<< " has Value PhoneNumber key"<<s<<"|"<<de.value("PhoneNumber");
QString show;
show = b.displayLabel();
show.append("\t");
show.append(de.value("PhoneNumber"));
ui->listWidget_2->addItem(show);
}