本文整理汇总了C++中QSet::end方法的典型用法代码示例。如果您正苦于以下问题:C++ QSet::end方法的具体用法?C++ QSet::end怎么用?C++ QSet::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSet
的用法示例。
在下文中一共展示了QSet::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getDocument
QSet<RPropertyTypeId> RBlockReferenceEntity::getPropertyTypeIds() const {
QSet<RPropertyTypeId> ret;
// TODO: move to RObject?
// add attribute tag / values as properties of the block reference:
const RDocument* doc = getDocument();
if (doc!=NULL) {
QSet<REntity::Id> childIds = doc->queryChildEntities(getId(), RS::EntityAttribute);
QSet<REntity::Id>::iterator it;
for (it=childIds.begin(); it!=childIds.end(); it++) {
REntity::Id childId = *it;
QSharedPointer<REntity> child = doc->queryEntityDirect(childId);
if (child.isNull()) {
continue;
}
QSet<RPropertyTypeId> childProperties = child->getPropertyTypeIds();
QSet<RPropertyTypeId>::iterator it2;
for (it2=childProperties.begin(); it2!=childProperties.end(); it2++) {
RPropertyTypeId pid = *it2;
QPair<QVariant, RPropertyAttributes> p = child->getProperty(pid);
if (p.second.isVisibleToParent()) {
pid.setId(RPropertyTypeId::INVALID_ID);
ret.insert(pid);
//qDebug() << pid.getCustomPropertyTitle() << " / " << pid.getCustomPropertyName();
//qDebug() << p.first.toString();
}
}
}
}
ret.unite(REntity::getPropertyTypeIds());
return ret;
}
示例2: createReplacementString
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QString PMFileGenerator::createReplacementString(FileType type, QSet<QString> names)
{
QString pluginName = getPluginName();
QString replaceStr = "";
if (type == CMAKELISTS)
{
// Build up the huge string full of namespaces using names
QSet<QString>::iterator iter = names.begin();
while (iter != names.end())
{
QString name = *iter;
if (name == "@[email protected]")
{
name.replace("@[email protected]", pluginName);
}
replaceStr.append("AddDREAM3DUnitTest(TESTNAME " + name + "Test SOURCES ${${PROJECT_NAME}_SOURCE_DIR}/" + name + "Test.cpp LINK_LIBRARIES ${${PROJECT_NAME}_Link_Libs})");
if (++iter != names.end())
{
replaceStr.append("\n");
}
}
}
else if (type == TESTFILELOCATIONS)
{
// Build up the huge string full of namespaces using names
QSet<QString>::iterator iter = names.begin();
while (iter != names.end())
{
QString name = *iter;
if (name == "@[email protected]")
{
name.replace("@[email protected]", pluginName);
}
replaceStr.append("namespace " + name + "Test\n");
replaceStr.append(" {\n");
replaceStr.append(" const QString TestFile1(\"@[email protected]/TestFile1.txt\");\n");
replaceStr.append(" const QString TestFile2(\"@[email protected]/TestFile2.txt\");\n");
replaceStr.append(" }");
if (++iter != names.end())
{
replaceStr.append("\n\n");
}
}
}
return replaceStr;
}
示例3: overwriteBlock
/**
* Overwrites a potentially existing block with the given block.
*/
bool RTransaction::overwriteBlock(QSharedPointer<RBlock> block) {
QString blockName = block->getName();
if (blockName==RBlock::modelSpaceName) {
//qWarning() << "RTransaction::overwriteBlock: "
// "trying to overwrite the model space block";
return false;
}
bool hasBlock = storage->hasBlock(blockName);
QSet<REntity::Id> refs;
// block exists and must be overwritten:
if (hasBlock) {
// temporarily 'ground' all existing references to the existing block:
refs = storage->queryBlockReferences(storage->getBlockId(blockName));
QSet<REntity::Id>::iterator it;
for (it = refs.begin(); it != refs.end(); ++it) {
QSharedPointer<RBlockReferenceEntity> e =
storage->queryEntity(*it).dynamicCast<RBlockReferenceEntity> ();
if (!e.isNull() && !e->isUndone()) {
e->setReferencedBlockId(REntity::INVALID_ID);
addObject(e, false);
}
}
// delete existing block in dest:
// block references are not deleted,
// because they no longer reference this block
// block contents is deleted
deleteObject(storage->getBlockId(blockName));
}
// add new block to dest or overwrite block:
addObject(block);
// block exists and must be overwritten:
if (hasBlock) {
// point previously grounded block references to new block:
QSet<REntity::Id>::iterator it;
for (it = refs.begin(); it != refs.end(); ++it) {
QSharedPointer<RBlockReferenceEntity> e =
storage->queryEntity(*it).dynamicCast<RBlockReferenceEntity> ();
if (!e.isNull() && !e->isUndone()) {
e->setReferencedBlockId(block->getId());
addObject(e, false);
affectedBlockReferenceIds.insert(*it);
}
}
}
return true;
}
示例4: checkseeniff
bool checkseeniff(QSet const& qs) {
for (QSet::const_iterator i = qs.begin(), e = qs.end(); i != e; ++i)
if (test(seenq, *i))
reset(seenq, *i);
else {
for (QSet::const_iterator j = qs.begin(); j != i; ++j) // undo resets
setValue(seenq, *j);
return false;
}
bool ret = true;
if (seenq.count()) ret = false;
for (QSet::const_iterator i = qs.begin(), e = qs.end(); i != e; ++i) // undo resets
setValue(seenq, *i);
return ret;
}
示例5: scanFolder
void MusicScanner::scanFolder(MusicLibraryItemRoot *library, const QString &topLevel, const QString &f,
QSet<FileOnlySong> &existing, int level)
{
if (stopRequested) {
return;
}
if (level<4) {
QDir d(f);
QFileInfoList entries=d.entryInfoList(QDir::Files|QDir::NoSymLinks|QDir::Dirs|QDir::NoDotAndDotDot);
MusicLibraryItemArtist *artistItem = 0;
MusicLibraryItemAlbum *albumItem = 0;
foreach (const QFileInfo &info, entries) {
if (stopRequested) {
return;
}
if (info.isDir()) {
scanFolder(library, topLevel, info.absoluteFilePath(), existing, level+1);
} else if(info.isReadable()) {
Song song;
QString fname=info.absoluteFilePath().mid(topLevel.length());
if (fname.endsWith(".jpg", Qt::CaseInsensitive) || fname.endsWith(".png", Qt::CaseInsensitive) ||
fname.endsWith(".lyrics", Qt::CaseInsensitive) || fname.endsWith(".pamp", Qt::CaseInsensitive)) {
continue;
}
song.file=fname;
QSet<FileOnlySong>::iterator it=existing.find(song);
if (existing.end()==it) {
song=Tags::read(info.absoluteFilePath());
song.file=fname;
} else {
song=*it;
existing.erase(it);
}
if (song.isEmpty()) {
continue;
}
count++;
int t=time(NULL);
if ((t-lastUpdate)>=2 || 0==(count%5)) {
lastUpdate=t;
emit songCount(count);
}
song.fillEmptyFields();
song.size=info.size();
if (!artistItem || song.artistOrComposer()!=artistItem->data()) {
artistItem = library->artist(song);
}
if (!albumItem || albumItem->parentItem()!=artistItem || song.albumName()!=albumItem->data()) {
albumItem = artistItem->album(song);
}
MusicLibraryItemSong *songItem = new MusicLibraryItemSong(song, albumItem);
albumItem->append(songItem);
albumItem->addGenre(song.genre);
artistItem->addGenre(song.genre);
library->addGenre(song.genre);
}
}
}
示例6: openViewer
void CFontFileListView::openViewer()
{
// Number of fonts user has selected, before we ask if they really want to view them all...
static const int constMaxBeforePrompt=10;
QList<QTreeWidgetItem *> items(selectedItems());
QTreeWidgetItem *item;
QSet<QString> files;
foreach(item, items)
if(item->parent()) // Then it is a file, not font name :-)
files.insert(item->text(0));
if(files.count() &&
(files.count()<constMaxBeforePrompt ||
KMessageBox::Yes==KMessageBox::questionYesNo(this, i18np("Open font in font viewer?",
"Open all %1 fonts in font viewer?",
files.count()))))
{
QSet<QString>::ConstIterator it(files.begin()),
end(files.end());
for(; it!=end; ++it)
{
QStringList args;
args << (*it);
QProcess::startDetached(Misc::app(KFI_VIEWER), args);
}
}
}
示例7: checkRecursion
/**
* Checks recursively, if the given block is allowed to contain
* references to the potential child block.
*
* \return true if a recusrion has been found.
*/
bool RMemoryStorage::checkRecursion(
RBlock::Id blockId, RBlock::Id potentialChildBlockId) {
if (blockId==potentialChildBlockId) {
return true;
}
// iterate through all entities inside potential child block and check
// if anything refers back to the given block:
QSet<REntity::Id> ids = queryBlockEntities(potentialChildBlockId);
QSet<REntity::Id>::iterator it;
for (it = ids.begin(); it != ids.end(); ++it) {
QSharedPointer<REntity> e = queryEntityDirect(*it);
QSharedPointer<RBlockReferenceEntity> blockRef = e.dynamicCast<
RBlockReferenceEntity> ();
if (blockRef.isNull()) {
continue;
}
if (blockRef->getReferencedBlockId() == blockId) {
return true;
}
if (checkRecursion(blockId, blockRef->getReferencedBlockId())) {
return true;
}
}
return false;
}
示例8: mergeArraysOfStrings
bool mergeArraysOfStrings(const QJsonArray &arrayFrom, QJsonArray &arrayTo) {
QJsonArray arrayMerged;
QSet<QString> commonValues;
commonValues.reserve(arrayTo.size() + arrayFrom.size());
int i = 0;
int sizeTo = arrayTo.size();
for (i = 0; i < sizeTo; ++i) {
Q_ASSERT(arrayTo[i].type() == QJsonValue::String);
commonValues.insert(arrayTo[i].toString());
}
int sizeFrom = arrayFrom.size();
for (i = 0; i < sizeFrom; ++i) {
Q_ASSERT(arrayFrom[i].type() == QJsonValue::String);
commonValues.insert(arrayFrom[i].toString());
}
QSet<QString>::iterator begin = commonValues.begin();
QSet<QString>::iterator end = commonValues.end();
for (QSet<QString>::iterator it = begin; it != end; ++it) {
arrayMerged.append(*it);
}
arrayTo = arrayMerged;
return true;
}
示例9: nearestName
QString nearestName( const QString& actual, const QSet<QString>& candidates )
{
int deltaBest = 10000;
int numBest = 0;
QString best;
QSet<QString>::ConstIterator c = candidates.begin();
while ( c != candidates.end() ) {
if ( (*c)[0] == actual[0] ) {
int delta = editDistance( actual, *c );
if ( delta < deltaBest ) {
deltaBest = delta;
numBest = 1;
best = *c;
} else if ( delta == deltaBest ) {
numBest++;
}
}
++c;
}
if ( numBest == 1 && deltaBest <= 2 &&
actual.length() + best.length() >= 5 ) {
return best;
} else {
return "";
}
}
示例10: deleteTransactionsFrom
void RMemoryStorage::deleteTransactionsFrom(int transactionId) {
QSet<int> keysToRemove;
{
QHash<int, RTransaction>::iterator it;
for (it = transactionMap.begin(); it!=transactionMap.end(); ++it) {
if (it.key()>=transactionId) {
// delete orphaned objects:
QList<RObject::Id> affectedObjects =
it.value().getAffectedObjects();
QList<RObject::Id>::iterator it2;
for (it2=affectedObjects.begin(); it2!=affectedObjects.end(); ++it2) {
QSharedPointer<RObject> obj = queryObjectDirect(*it2);
if (!obj.isNull() && obj->isUndone()) {
deleteObject(*it2);
}
}
// delete transaction:
keysToRemove.insert(it.key());
}
}
}
{
QSet<int>::iterator it;
for (it=keysToRemove.begin(); it!=keysToRemove.end(); ++it) {
transactionMap.remove(*it);
}
}
}
示例11: setEntitySelected
/**
* Selects first the top most parent in the entity hierarchy and then
* all children of it. This is necessary for attributes which are
* children of block references.
*/
void RMemoryStorage::setEntitySelected(QSharedPointer<REntity> entity, bool on,
QSet<REntity::Id>* affectedEntities, bool onlyDescend) {
// disabled:
// attributes can be selected individually to edit their attributes
// if (!onlyDescend) {
// // entity has a parent: select parent instead
// // (select block ref for attribute):
// REntity::Id parentId = entity->getParentId();
// QSharedPointer<REntity> parent = queryEntityDirect(parentId);
// if (!parent.isNull()) {
// setEntitySelected(parent, on, affectedEntities);
// return;
// }
// }
entity->setSelected(on);
if (affectedEntities!=NULL) {
affectedEntities->insert(entity->getId());
}
// if this is a parent, select all child entities (attributes for block ref):
if (hasChildEntities(entity->getId())) {
QSet<REntity::Id> childIds = queryChildEntities(entity->getId());
QSet<REntity::Id>::iterator it;
for (it=childIds.begin(); it!=childIds.end(); it++) {
REntity::Id childId = *it;
QSharedPointer<REntity> child = queryEntityDirect(childId);
if (child.isNull()) {
continue;
}
setEntitySelected(child, on, affectedEntities, true);
}
}
}
示例12: mouseMoveEvent
void PointSetAnnotationTool::mouseMoveEvent(QMouseEvent *event) {
if (_viewer) {
if (_generating) {
QPointF scenePos = _viewer->mapToScene(event->pos());
if (event->buttons() == Qt::LeftButton) {
if (QLineF(_viewer->mapFromScene(scenePos), _viewer->mapFromScene(QPointF(_last.getX(), _last.getY()))).length() > 40) {
addCoordinate(scenePos);
}
}
}
else if (_startSelectionMove && event->modifiers() == Qt::AltModifier) {
QPointF scenePos = _viewer->mapToScene(event->pos());
QSet<QtAnnotation*> selected = _annotationPlugin->getSelectedAnnotations();
for (QSet<QtAnnotation*>::iterator it = selected.begin(); it != selected.end(); ++it) {
QPointF delta = (scenePos - _moveStart);
(*it)->moveCoordinatesBy(Point(delta.x(), delta.y()));
}
_moveStart = scenePos;
}
else if (_startSelectionMove) {
QPointF scenePos = _viewer->mapToScene(event->pos());
PointSetQtAnnotation* active = dynamic_cast<PointSetQtAnnotation*>(_annotationPlugin->getActiveAnnotation());
if (active && active->getEditable()) {
int activeSeedPoint = active->getActiveSeedPoint();
if (activeSeedPoint >= 0) {
QPointF delta = (scenePos - _moveStart);
active->moveCoordinateBy(activeSeedPoint, Point(delta.x(), delta.y()));
_moveStart = scenePos;
}
}
}
event->accept();
}
}
示例13: UpdateGroup
int CFrmUserList::UpdateGroup(CRoster* pRoster, QSet<QString> groups)
{
if(groups.isEmpty())
{
QString szDefaulGroup(tr("My friends"));
groups.insert(szDefaulGroup);
}
for(QSet<QString>::iterator itGroup = groups.begin(); itGroup != groups.end(); itGroup++)
{
QString szGroup = *itGroup;
QStandardItem* lstGroup = NULL;
QMap<QString, QStandardItem*>::iterator it;
it = m_Groups.find(szGroup);
if(m_Groups.end() == it)
{
//新建立组条目
/*lstGroup = new QStandardItem(szGroup);
lstGroup->setEditable(false); //禁止双击编辑
m_pModel->appendRow(lstGroup);
m_Groups.insert(szGroup, lstGroup);//*/
lstGroup = InsertGroup(szGroup);
}
else
lstGroup = it.value();
lstGroup->appendRow(pRoster->GetItem());
LOG_MODEL_DEBUG("Roster", "CFrmUserList::UpdateGroup:%s,(%s)",
qPrintable(pRoster->BareJid()),
qPrintable(szGroup));
}
return 0;
}
示例14: GetAllThreadNames
void MThread::GetAllThreadNames(QStringList &list)
{
QMutexLocker locker(&s_all_threads_lock);
QSet<MThread*>::const_iterator it;
for (it = s_all_threads.begin(); it != s_all_threads.end(); ++it)
list.push_back((*it)->objectName());
}
示例15: save
//FIXME: Commas in names
bool Bookmarks::save()
{
QFile file(m_bookmarksFile);
if(file.open(QFile::WriteOnly | QFile::Truncate | QIODevice::Text))
{
QTextStream stream(&file);
stream << QString("# Tag name").leftJustified(20) + "; " +
QString(" color") << endl;
QSet<TagInfo*> usedTags;
for (int iBookmark = 0; iBookmark < m_BookmarkList.size(); iBookmark++)
{
BookmarkInfo& info = m_BookmarkList[iBookmark];
for(int iTag = 0; iTag < info.tags.size(); ++iTag)
{
TagInfo& tag = *info.tags[iTag];
usedTags.insert(&tag);
}
}
for (QSet<TagInfo*>::iterator i = usedTags.begin(); i != usedTags.end(); i++)
{
TagInfo& info = **i;
stream << info.name.leftJustified(20) + "; " + info.color.name() << endl;
}
stream << endl;
stream << QString("# Frequency").leftJustified(12) + "; " +
QString("Name").leftJustified(25)+ "; " +
QString("Modulation").leftJustified(20) + "; " +
QString("Bandwidth").rightJustified(10) + "; " +
QString("Tags") << endl;
for (int i = 0; i < m_BookmarkList.size(); i++)
{
BookmarkInfo& info = m_BookmarkList[i];
QString line = QString::number(info.frequency).rightJustified(12) +
"; " + info.name.leftJustified(25) + "; " +
info.modulation.leftJustified(20)+ "; " +
QString::number(info.bandwidth).rightJustified(10) + "; ";
for(int iTag = 0; iTag<info.tags.size(); ++iTag)
{
TagInfo& tag = *info.tags[iTag];
if(iTag!=0)
{
line.append(",");
}
line.append(tag.name);
}
stream << line << endl;
}
file.close();
return true;
}
return false;
}