本文整理汇总了C++中QContactNickname::nickname方法的典型用法代码示例。如果您正苦于以下问题:C++ QContactNickname::nickname方法的具体用法?C++ QContactNickname::nickname怎么用?C++ QContactNickname::nickname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QContactNickname
的用法示例。
在下文中一共展示了QContactNickname::nickname方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
}
syncTimer.start();
manager.saveContacts(&contactsToAggregate);
aggregationElapsed = syncTimer.elapsed();
totalAggregatesInDatabase = manager.contactIds().count();
qDebug() << "Average time for aggregation of" << contactsToAggregate.size() << "contacts (with" << totalAggregatesInDatabase << "existing in database):" << aggregationElapsed
<< "milliseconds (" << ((1.0 * aggregationElapsed) / (1.0 * contactsToAggregate.size())) << " msec per aggregated contact )";
elapsedTimeTotal += aggregationElapsed;
// The next test is about updating existing contacts, amongst a large set.
// We're especially interested in presence updates, as these are common.
qDebug() << "\n\nPerforming presence update tests:";
// in the first presence update test, we update a small number of contacts.
QStringList presenceAvatars = generateAvatarsList();
QList<QContact> contactsToUpdate;
for (int i = 0; i < 10; ++i) {
contactsToUpdate.append(prefillData.at(prefillData.size() - 1 - i));
}
// modify the presence, nickname and avatar of the test data
for (int j = 0; j < contactsToUpdate.size(); ++j) {
QString genstr = QString::number(j);
QContact curr = contactsToUpdate[j];
QContactPresence cp = curr.detail<QContactPresence>();
QContactNickname nn = curr.detail<QContactNickname>();
QContactAvatar av = curr.detail<QContactAvatar>();
cp.setNickname(genstr);
cp.setCustomMessage(genstr);
cp.setTimestamp(QDateTime::currentDateTime());
cp.setPresenceState(static_cast<QContactPresence::PresenceState>(qrand() % 4));
nn.setNickname(nn.nickname() + genstr);
av.setImageUrl(genstr + presenceAvatars.at(qrand() % presenceAvatars.size()));
curr.saveDetail(&cp);
curr.saveDetail(&nn);
curr.saveDetail(&av);
contactsToUpdate.replace(j, curr);
}
// perform a batch save.
syncTimer.start();
manager.saveContacts(&contactsToUpdate);
qint64 presenceElapsed = syncTimer.elapsed();
totalAggregatesInDatabase = manager.contactIds().count();
qDebug() << " update ( batch of" << contactsToUpdate.size() << ") presence+nick+avatar (with" << totalAggregatesInDatabase << "existing in database, all overlap):" << presenceElapsed
<< "milliseconds (" << ((1.0 * presenceElapsed) / (1.0 * contactsToUpdate.size())) << " msec per updated contact )";
elapsedTimeTotal += presenceElapsed;
// in the second presence update test, we update ALL of the contacts
// This simulates having a large number of contacts from a single source (eg, a social network)
// where (due to changed connectivity status) presence updates for the entire set become available.
contactsToUpdate.clear();
QDateTime timestamp = QDateTime::currentDateTime();
for (int j = 0; j < prefillData.size(); ++j) {
QContact curr = prefillData.at(j);
QString genstr = QString::number(j) + "2";
QContactPresence cp = curr.detail<QContactPresence>();
QContactNickname nn = curr.detail<QContactNickname>();
QContactAvatar av = curr.detail<QContactAvatar>();
cp.setNickname(genstr);
cp.setCustomMessage(genstr);
cp.setTimestamp(timestamp);
cp.setPresenceState(static_cast<QContactPresence::PresenceState>((qrand() % 4) + 1));
nn.setNickname(nn.nickname() + genstr);
示例2: nickname
QString SeasidePerson::nickname() const
{
QContactNickname nameDetail = mContact.detail<QContactNickname>();
return nameDetail.nickname();
}