本文整理汇总了C++中QVersitProperty::groups方法的典型用法代码示例。如果您正苦于以下问题:C++ QVersitProperty::groups方法的具体用法?C++ QVersitProperty::groups怎么用?C++ QVersitProperty::groups使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QVersitProperty
的用法示例。
在下文中一共展示了QVersitProperty::groups方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: encodeGroupsAndName
/*!
* Encodes the groups and name in the \a property and writes it to the device
*/
void QVersitDocumentWriter::encodeGroupsAndName(const QVersitProperty& property)
{
QStringList groups = property.groups();
if (!groups.isEmpty()) {
writeString(groups.join(QStringLiteral(".")));
writeString(QStringLiteral("."));
}
writeString(property.name());
}
示例2: propertyProcessed
bool QVCardRestoreHandler::propertyProcessed(
const QVersitProperty& property,
QList<QContactDetail>* updatedDetails)
{
bool success = false;
QString group;
if (!property.groups().isEmpty())
group = property.groups().first();
if (property.name() == PropertyName) {
if (property.groups().size() != 1)
return false;
QMultiHash<QString, QString> parameters = property.parameters();
QContactDetail::DetailType detailType = QContactDetail::DetailType(parameters.value(DetailTypeParameter).toUInt());
QString fieldName = parameters.value(FieldParameter);
// Find a detail previously seen with the same definitionName, which was generated from
// a property from the same group
QContactDetail detail(detailType);
foreach (const QContactDetail& previousDetail, mDetailGroupMap.detailsInGroup(group)) {
if (previousDetail.type() == detailType) {
detail = previousDetail;
}
}
// If not found, it's a new empty detail with the definitionName set.
detail.setValue(fieldName.toInt(), deserializeValue(property));
// Replace the equivalent detail in updatedDetails with the new one
QMutableListIterator<QContactDetail> it(*updatedDetails);
while (it.hasNext()) {
if (it.next().key() == detail.key()) {
it.remove();
break;
}
}
updatedDetails->append(detail);
success = true;
}
if (!group.isEmpty()) {
// Keep track of which details were generated from which Versit groups
foreach (const QContactDetail& detail, *updatedDetails) {
mDetailGroupMap.insert(group, detail);
}
}
示例3: qHash
/*! Returns the hash value for \a key. */
uint qHash(const QVersitProperty &key)
{
uint hash = QT_PREPEND_NAMESPACE(qHash)(key.name()) + QT_PREPEND_NAMESPACE(qHash)(key.value());
foreach (const QString& group, key.groups()) {
hash += QT_PREPEND_NAMESPACE(qHash)(group);
}
QHash<QString,QString>::const_iterator it = key.parameters().constBegin();
QHash<QString,QString>::const_iterator end = key.parameters().constEnd();
while (it != end) {
hash += QT_PREPEND_NAMESPACE(qHash)(it.key()) + QT_PREPEND_NAMESPACE(qHash)(it.value());
++it;
}
return hash;
}
示例4: foreach
QDebug operator<<(QDebug dbg, const QVersitProperty& property)
{
QStringList groups = property.groups();
QString name = property.name();
QMultiHash<QString,QString> parameters = property.parameters();
dbg.nospace() << "QVersitProperty(";
foreach (const QString& group, groups) {
dbg.nospace() << group << '.';
}
dbg.nospace() << name;
QHash<QString,QString>::const_iterator it;
for (it = parameters.constBegin(); it != parameters.constEnd(); ++it) {
dbg.nospace() << ';' << it.key() << '=' << it.value();
}
if (property.valueType() == QVersitProperty::VersitDocumentType)
dbg.nospace() << ':' << property.value<QVersitDocument>();
else
dbg.nospace() << ':' << property.variantValue();
dbg.nospace() << ')';
return dbg.maybeSpace();
}