本文整理汇总了C++中QContact::detail方法的典型用法代码示例。如果您正苦于以下问题:C++ QContact::detail方法的具体用法?C++ QContact::detail怎么用?C++ QContact::detail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QContact
的用法示例。
在下文中一共展示了QContact::detail方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: synthesizedDisplayLabel
QString CntSymbianSimEngine::synthesizedDisplayLabel(const QContact& contact, QContactManager::Error* error) const
{
Q_UNUSED(error);
QContactName name = contact.detail(QContactName::DefinitionName);
if(!name.customLabel().isEmpty()) {
return name.customLabel();
} else {
return QString("");
}
}
示例2: QString
/* Synthesise the display label of a contact */
QString QContactMaemo5Engine::synthesizedDisplayLabel(const QContact& contact, QContactManager::Error* error) const
{
QString label;
// Try to get the display name from the OSSO-ABook Contact
label = d->m_abook->getDisplayName(contact);
// Synthesise the display label for not saved contacts
// A. FirstName + LastName
if (label.isEmpty()){
QContactName name = contact.detail(QContactName::DefinitionName);
QStringList nameList;
nameList << name.firstName();
if (name.lastName().count()){
nameList << name.lastName();
}
label = nameList.join(QString(' '));
}
// B. Email
if (label.isEmpty()){
QContactEmailAddress email = contact.detail(QContactEmailAddress::DefinitionName);
label = email.emailAddress();
}
//
if (label.isEmpty()){
*error = QContactManager::UnspecifiedError;
return QString("No name");
}
*error = QContactManager::NoError;
return label;
}
示例3: 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);
}
示例4: generateDisplayLabel
/*!
* Generate the display label
* \a contact to read the data from .
* \a detailList contains the details to be read from the contact
* \return synthesised display label
*/
QString CntDisplayLabel::generateDisplayLabel( const QContact &contact, const QList<QList<QPair<QLatin1String, QLatin1String> > > detailList) const
{
// Default to empty display label. It is up to the client to create a
// localised presentation of a contact without a name.
QString displayLabel("");
//loop through the details and create display label
for(int i = 0; i < detailList.count() && displayLabel.isEmpty(); i++ )
{
QList<QPair<QLatin1String, QLatin1String> > detailPairList = detailList.at(i);
QContactDetail contactDetail;
for(int j = 0; j < detailPairList.count(); j++)
{
contactDetail = contact.detail(detailPairList.at(j).first);
if(displayLabel.isEmpty()){ //read the value and set it as display label
displayLabel = contactDetail.value(detailPairList.at(j).second);
}
else{ //read the value and append it to the display label
QString label = contactDetail.value(detailPairList.at(j).second);
if(!label.isEmpty())
{
#ifdef SYMBIAN_BACKEND_USE_SQLITE
// Inlcude a comma if needed in the display label
if (m_nameOrder == CntOrderLastCommaFirst)
displayLabel.append(comma());
#endif
displayLabel.append(delimiter());
displayLabel.append(label);
}
}
}
}
return displayLabel;
}