本文整理汇总了C++中QSet::cbegin方法的典型用法代码示例。如果您正苦于以下问题:C++ QSet::cbegin方法的具体用法?C++ QSet::cbegin怎么用?C++ QSet::cbegin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSet
的用法示例。
在下文中一共展示了QSet::cbegin方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: acceptsValueImpl
FormGenAcceptResult FormGenRecordComposition::acceptsValueImpl(const QVariant &val) const
{
if( variantType(val) != QMetaType::QVariantHash )
return FormGenAcceptResult::reject({}, val);
QVariantHash hash = val.toHash();
QStringList valueStringList;
QSet<QString> processedTags;
for( const auto &elm : mElements ) {
auto elementAccepts = elm.element->acceptsValue(hash.value(elm.tag));
if( ! elementAccepts.acceptable ) {
QString path = elm.tag;
if( ! elementAccepts.path.isEmpty() )
path += QString("/%1").arg(elementAccepts.path);
return FormGenAcceptResult::reject(path, elementAccepts.value);
}
valueStringList.append(FormGenElement::keyStringValuePair(elm.tag, elementAccepts.valueString));
processedTags.insert(elm.tag);
}
QSet<QString> remainingTags = hash.keys().toSet() - processedTags;
if( ! remainingTags.isEmpty() )
return FormGenAcceptResult::reject(*remainingTags.cbegin(),
hash.value(*remainingTags.cbegin()));
return FormGenAcceptResult::accept(val, FormGenElement::objectString(valueStringList));
}
示例2: qDebug
void TvmBarDataProxy::generate(const QSet<qint64>& rowKeys, int rowCount, int tvmRowIndex)
{
qDebug() << "qps::TvmBarDataProxy::generate(): tvm=" << _tvm.data();
if ( !getTvm() ) {
resetArray(nullptr);
return;
}
if ( tvmRowIndex >= rowCount ) {
qWarning() << "qps::TvmBarDataProxy::generate(): Warning: row >= rowCount.";
return;
}
// Generate empty rows for all tvms (ie for rowCount)
QBarDataArray* barDataArray = new QBarDataArray{};
barDataArray->reserve(rowCount);
for ( int r = 0; r < rowCount; r++ )
barDataArray->append(new QBarDataRow{});
// Generate a row with rowKeys.size() columns for the TVM
QBarDataRow* tvmBarDataRow = new QBarDataRow(rowKeys.size());
auto i = _tvm->getMap().constBegin();
while ( i != _tvm->getMap().constEnd() ) {
QSet<qint64>::const_iterator rowIndexIter = rowKeys.find(i.key());
if ( rowIndexIter != rowKeys.constEnd()) {
int rowIndex = std::distance(rowKeys.cbegin(), rowIndexIter);
if ( rowIndex >= 0 &&
rowIndex < tvmBarDataRow->size() )
(*tvmBarDataRow)[rowIndex].setValue( static_cast<float>(i.value()));
}
++i;
}
barDataArray->replace(tvmRowIndex, tvmBarDataRow); // Finnaly replace empty tvm row with the tvm data row
resetArray(barDataArray);
}
示例3: findModel
QString ModelIndexer::findModel(const qmt::Uid &modelUid)
{
QMutexLocker locker(&d->indexerMutex);
QSet<IndexedModel *> indexedModels = d->indexedModelsByUid.value(modelUid);
if (indexedModels.isEmpty())
return QString();
IndexedModel *indexedModel = *indexedModels.cbegin();
QMT_ASSERT(indexedModel, return QString());
return indexedModel->file();
}
示例4: findDiagram
QString ModelIndexer::findDiagram(const qmt::Uid &modelUid, const qmt::Uid &diagramUid)
{
Q_UNUSED(modelUid); // avoid warning in release mode
QMutexLocker locker(&d->indexerMutex);
QSet<IndexedDiagramReference *> indexedDiagramReferences = d->indexedDiagramReferencesByDiagramUid.value(diagramUid);
if (indexedDiagramReferences.isEmpty())
return QString();
IndexedDiagramReference *indexedDiagramReference = *indexedDiagramReferences.cbegin();
QMT_ASSERT(indexedDiagramReference, return QString());
QMT_ASSERT(indexedDiagramReference->modelUid() == modelUid, return QString());
return indexedDiagramReference->file();
}
示例5: ph_page_requested_urls
char* ph_page_requested_urls(void *page) {
ph::Page *p = (ph::Page*)page;
QSet<QString> urlsList = p->requestedUrls();
QJsonArray urls;
for(auto i=urlsList.cbegin(); i != urlsList.cend(); ++i) {
urls.append(QJsonValue((*i)));
}
QByteArray requestedUrls = QJsonDocument(urls).toJson();
char *resultData = new char[requestedUrls.size() + 1];
qstrncpy(resultData, requestedUrls.data(), requestedUrls.size() + 1);
return resultData;
}
示例6: deleteFlags
bool Store::deleteFlags(const PimItem::List &items, const QSet<QByteArray> &flags, bool &flagsChanged)
{
DataStore *store = connection()->storageBackend();
QVector<Flag> flagList;
flagList.reserve(flags.size());
for (auto iter = flags.cbegin(), end = flags.cend(); iter != end; ++iter) {
Flag flag = Flag::retrieveByName(QString::fromUtf8(*iter));
if (!flag.isValid()) {
continue;
}
flagList.append(flag);
}
if (!store->removeItemsFlags(items, flagList, &flagsChanged)) {
qCDebug(AKONADISERVER_LOG) << "Store::deleteFlags: Unable to remove item flags";
return false;
}
return true;
}