本文整理汇总了C++中Flag::id方法的典型用法代码示例。如果您正苦于以下问题:C++ Flag::id方法的具体用法?C++ Flag::id怎么用?C++ Flag::id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flag
的用法示例。
在下文中一共展示了Flag::id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doAppendItemsFlag
bool DataStore::doAppendItemsFlag(const PimItem::List &items, const Flag &flag,
const QSet<Entity::Id> &existing, const Collection &col_,
bool silent)
{
Collection col = col_;
QVariantList flagIds;
QVariantList appendIds;
PimItem::List appendItems;
Q_FOREACH (const PimItem &item, items) {
if (existing.contains(item.id())) {
continue;
}
flagIds << flag.id();
appendIds << item.id();
appendItems << item;
if (col.id() == -1) {
col.setId(item.collectionId());
} else if (col.id() != item.collectionId()) {
col.setId(-2);
}
}
if (appendItems.isEmpty()) {
return true; // all items have the desired flags already
}
QueryBuilder qb2(PimItemFlagRelation::tableName(), QueryBuilder::Insert);
qb2.setColumnValue(PimItemFlagRelation::leftColumn(), appendIds);
qb2.setColumnValue(PimItemFlagRelation::rightColumn(), flagIds);
qb2.setIdentificationColumn(QString());
if (!qb2.exec()) {
qCDebug(AKONADISERVER_LOG) << "Failed to execute query:" << qb2.query().lastError();
return false;
}
if (!silent) {
mNotificationCollector->itemsFlagsChanged(appendItems, QSet<QByteArray>() << flag.name().toLatin1(),
QSet<QByteArray>(), col);
}
return true;
}
示例2: qb
Q_FOREACH (const Flag &flag, flags) {
QSet<PimItem::Id> existing;
if (checkIfExists) {
QueryBuilder qb(PimItemFlagRelation::tableName(), QueryBuilder::Select);
Query::Condition cond;
cond.addValueCondition(PimItemFlagRelation::rightColumn(), Query::Equals, flag.id());
cond.addValueCondition(PimItemFlagRelation::leftColumn(), Query::In, itemsIds);
qb.addColumn(PimItemFlagRelation::leftColumn());
qb.addCondition(cond);
if (!qb.exec()) {
qCDebug(AKONADISERVER_LOG) << "Failed to execute query:" << qb.query().lastError();
return false;
}
QSqlQuery query = qb.query();
if (query.driver()->hasFeature(QSqlDriver::QuerySize)) {
//The query size feature is not suppoerted by the sqllite driver
if (query.size() == items.count()) {
continue;
}
setBoolPtr(flagsChanged, true);
}
while (query.next()) {
existing << query.value(0).value<PimItem::Id>();
}
if (!query.driver()->hasFeature(QSqlDriver::QuerySize)) {
if (existing.size() != items.count()) {
setBoolPtr(flagsChanged, true);
}
}
}
if (!doAppendItemsFlag(items, flag, existing, col, silent)) {
return false;
}
}