Compile fix with recent Qt dev

The reasoning in 1b4766e26c did not take into account that the scope
of QT_NO_JAVA_STYLE_ITERATORS may change over time, as done with
f70905448f6 in Qt base.

Change-Id: Ib1966ff26c4d36d5f62e149d6b45baa4aecf825d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2019-07-24 13:43:54 +02:00
parent 02e224fcfa
commit e3b1106afa
70 changed files with 238 additions and 491 deletions

View File

@@ -587,13 +587,8 @@ QList<ServerNodeInstance> NodeInstanceServer::setupInstances(const CreateSceneCo
setInstanceAuxiliaryData(container);
}
QListIterator<ServerNodeInstance> instanceListIterator(instanceList);
instanceListIterator.toBack();
while (instanceListIterator.hasPrevious()) {
ServerNodeInstance instance = instanceListIterator.previous();
instance.doComponentComplete();
}
for (int i = instanceList.size(); --i >= 0; )
instanceList[i].doComponentComplete();
return instanceList;
}

View File

@@ -581,18 +581,14 @@ bool ResolveExpression::visit(UnaryExpressionAST *ast)
accept(ast->expression);
unsigned unaryOp = tokenKind(ast->unary_op_token);
if (unaryOp == T_AMPER) {
QMutableListIterator<LookupItem > it(_results);
while (it.hasNext()) {
LookupItem p = it.next();
for (LookupItem &p : _results) {
FullySpecifiedType ty = p.type();
ty.setType(control()->pointerType(ty));
p.setType(ty);
it.setValue(p);
}
} else if (unaryOp == T_STAR) {
QMutableListIterator<LookupItem > it(_results);
while (it.hasNext()) {
LookupItem p = it.next();
for (int i = 0; i < _results.size(); ++i) {
LookupItem &p = _results[i];
FullySpecifiedType ty = p.type();
NamedType *namedTy = ty->asNamedType();
if (namedTy != 0) {
@@ -603,7 +599,6 @@ bool ResolveExpression::visit(UnaryExpressionAST *ast)
bool added = false;
if (PointerType *ptrTy = ty->asPointerType()) {
p.setType(ptrTy->elementType());
it.setValue(p);
added = true;
} else if (namedTy != 0) {
const Name *starOp = control()->operatorNameId(OperatorNameId::StarOp);
@@ -616,7 +611,6 @@ bool ResolveExpression::visit(UnaryExpressionAST *ast)
FullySpecifiedType retTy = proto->returnType().simplified();
p.setType(retTy);
p.setScope(proto->enclosingScope());
it.setValue(p);
added = true;
break;
}
@@ -626,7 +620,7 @@ bool ResolveExpression::visit(UnaryExpressionAST *ast)
}
}
if (!added)
it.remove();
_results.removeAt(i--);
}
}
return false;

View File

@@ -390,9 +390,8 @@ QSet<PluginSpec *> PluginManager::pluginsRequiredByPlugin(PluginSpec *spec)
while (!queue.empty()) {
PluginSpec *checkSpec = queue.front();
queue.pop();
QHashIterator<PluginDependency, PluginSpec *> depIt(checkSpec->dependencySpecs());
while (depIt.hasNext()) {
depIt.next();
const QHash<PluginDependency, PluginSpec *> deps = checkSpec->dependencySpecs();
for (auto depIt = deps.cbegin(), end = deps.cend(); depIt != end; ++depIt) {
if (depIt.key().type != PluginDependency::Required)
continue;
PluginSpec *depSpec = depIt.value();
@@ -933,7 +932,6 @@ void PluginManagerPrivate::deleteAll()
#ifdef WITH_TESTS
using TestPlan = QMap<QObject *, QStringList>; // Object -> selected test functions
using TestPlanIterator = QMapIterator<QObject *, QStringList>;
static bool isTestFunction(const QMetaMethod &metaMethod)
{
@@ -1019,9 +1017,7 @@ static int executeTestPlan(const TestPlan &testPlan)
{
int failedTests = 0;
TestPlanIterator it(testPlan);
while (it.hasNext()) {
it.next();
for (auto it = testPlan.cbegin(), end = testPlan.cend(); it != end; ++it) {
QObject *testObject = it.key();
QStringList functions = it.value();
@@ -1326,9 +1322,8 @@ bool PluginManagerPrivate::loadQueue(PluginSpec *spec,
}
// add dependencies
QHashIterator<PluginDependency, PluginSpec *> it(spec->dependencySpecs());
while (it.hasNext()) {
it.next();
const QHash<PluginDependency, PluginSpec *> deps = spec->dependencySpecs();
for (auto it = deps.cbegin(), end = deps.cend(); it != end; ++it) {
// Skip test dependencies since they are not real dependencies but just force-loaded
// plugins when running tests
if (it.key().type == PluginDependency::Test)
@@ -1374,9 +1369,8 @@ void PluginManagerPrivate::loadPlugin(PluginSpec *spec, PluginSpec::State destSt
break;
}
// check if dependencies have loaded without error
QHashIterator<PluginDependency, PluginSpec *> it(spec->dependencySpecs());
while (it.hasNext()) {
it.next();
const QHash<PluginDependency, PluginSpec *> deps = spec->dependencySpecs();
for (auto it = deps.cbegin(), end = deps.cend(); it != end; ++it) {
if (it.key().type != PluginDependency::Required)
continue;
PluginSpec *depSpec = it.value();

View File

@@ -929,9 +929,7 @@ QVector<PluginSpec *> PluginSpecPrivate::enableDependenciesIndirectly(bool enabl
if (!q->isEffectivelyEnabled()) // plugin not enabled, nothing to do
return {};
QVector<PluginSpec *> enabled;
QHashIterator<PluginDependency, PluginSpec *> it(dependencySpecs);
while (it.hasNext()) {
it.next();
for (auto it = dependencySpecs.cbegin(), end = dependencySpecs.cend(); it != end; ++it) {
if (it.key().type != PluginDependency::Required
&& (!enableTestDependencies || it.key().type != PluginDependency::Test))
continue;

View File

@@ -286,12 +286,9 @@ public:
ReplaceInTrie() { }
void operator()(QString s)
{
QHashIterator<QString, QString> i(replacements);
QString res = s;
while (i.hasNext()) {
i.next();
for (auto i = replacements.cbegin(), end = replacements.cend(); i != end; ++i)
res.replace(i.key(), i.value());
}
trie = TrieNode::insertF(trie,res);
}
};

View File

@@ -1577,9 +1577,8 @@ void Check::scanCommentsForAnnotations()
void Check::warnAboutUnnecessarySuppressions()
{
QHashIterator< int, QList<MessageTypeAndSuppression> > it(m_disabledMessageTypesByLine);
while (it.hasNext()) {
it.next();
for (auto it = m_disabledMessageTypesByLine.cbegin(), end = m_disabledMessageTypesByLine.cend();
it != end; ++it) {
foreach (const MessageTypeAndSuppression &entry, it.value()) {
if (!entry.wasSuppressed)
addMessage(WarnUnnecessaryMessageSuppression, entry.suppressionSource);

View File

@@ -584,10 +584,8 @@ void ImportDependencies::filter(const ViewerContext &vContext)
{
QMap<QString, CoreImport> newCoreImports;
QMap<ImportKey, QStringList> newImportCache;
QMapIterator<QString, CoreImport> j(m_coreImports);
bool hasChanges = false;
while (j.hasNext()) {
j.next();
for (auto j = m_coreImports.cbegin(), end = m_coreImports.cend(); j != end; ++j) {
const CoreImport &cImport = j.value();
if (vContext.languageIsCompatible(cImport.language)) {
QList<Export> newExports;
@@ -923,10 +921,8 @@ QSet<ImportKey> ImportDependencies::subdirImports(
void ImportDependencies::checkConsistency() const
{
QMapIterator<ImportKey, QStringList> j(m_importCache);
while (j.hasNext()) {
j.next();
foreach (const QString &s, j.value()) {
for (auto j = m_importCache.cbegin(), end = m_importCache.cend(); j != end; ++j) {
for (const QString &s : j.value()) {
bool found = false;
foreach (const Export &e, m_coreImports.value(s).possibleExports)
if (e.exportName == j.key())
@@ -934,19 +930,15 @@ void ImportDependencies::checkConsistency() const
Q_ASSERT(found); Q_UNUSED(found)
}
}
QMapIterator<QString,CoreImport> i(m_coreImports);
while (i.hasNext()) {
i.next();
for (auto i = m_coreImports.cbegin(), end = m_coreImports.cend(); i != end; ++i) {
foreach (const Export &e, i.value().possibleExports) {
if (!m_importCache.value(e.exportName).contains(i.key())) {
qCWarning(importsLog) << e.exportName.toString();
qCWarning(importsLog) << i.key();
QMapIterator<ImportKey, QStringList> j(m_importCache);
while (j.hasNext()) {
j.next();
for (auto j = m_importCache.cbegin(), end = m_importCache.cend(); j != end; ++j)
qCWarning(importsLog) << j.key().toString() << j.value();
}
qCWarning(importsLog) << m_importCache.contains(e.exportName);
qCWarning(importsLog) << m_importCache.value(e.exportName);
}

View File

@@ -1098,11 +1098,7 @@ bool ObjectValue::checkPrototype(const ObjectValue *, QSet<const ObjectValue *>
void ObjectValue::processMembers(MemberProcessor *processor) const
{
QHashIterator<QString, PropertyData> it(m_members);
while (it.hasNext()) {
it.next();
for (auto it = m_members.cbegin(), end = m_members.cend(); it != end; ++it) {
if (! processor->processProperty(it.key(), it.value().value, it.value().propertyInfo))
break;
}
@@ -2359,10 +2355,9 @@ TypeScope::TypeScope(const Imports *imports, ValueOwner *valueOwner)
const Value *TypeScope::lookupMember(const QString &name, const Context *context,
const ObjectValue **foundInObject, bool) const
{
QListIterator<Import> it(m_imports->all());
it.toBack();
while (it.hasPrevious()) {
const Import &i = it.previous();
const QList<Import> &imports = m_imports->all();
for (int pos = imports.size(); --pos >= 0; ) {
const Import &i = imports.at(pos);
const ObjectValue *import = i.object;
const ImportInfo &info = i.info;
@@ -2374,7 +2369,7 @@ const Value *TypeScope::lookupMember(const QString &name, const Context *context
if (info.as() == name) {
if (foundInObject)
*foundInObject = this;
i.used = true;
i.used = true; // FIXME: This evilly modifies a 'const' object
return import;
}
continue;
@@ -2392,10 +2387,9 @@ const Value *TypeScope::lookupMember(const QString &name, const Context *context
void TypeScope::processMembers(MemberProcessor *processor) const
{
QListIterator<Import> it(m_imports->all());
it.toBack();
while (it.hasPrevious()) {
const Import &i = it.previous();
const QList<Import> &imports = m_imports->all();
for (int pos = imports.size(); --pos >= 0; ) {
const Import &i = imports.at(pos);
const ObjectValue *import = i.object;
const ImportInfo &info = i.info;
@@ -2424,10 +2418,9 @@ JSImportScope::JSImportScope(const Imports *imports, ValueOwner *valueOwner)
const Value *JSImportScope::lookupMember(const QString &name, const Context *,
const ObjectValue **foundInObject, bool) const
{
QListIterator<Import> it(m_imports->all());
it.toBack();
while (it.hasPrevious()) {
const Import &i = it.previous();
const QList<Import> &imports = m_imports->all();
for (int pos = imports.size(); --pos >= 0; ) {
const Import &i = imports.at(pos);
const ObjectValue *import = i.object;
const ImportInfo &info = i.info;
@@ -2449,10 +2442,9 @@ const Value *JSImportScope::lookupMember(const QString &name, const Context *,
void JSImportScope::processMembers(MemberProcessor *processor) const
{
QListIterator<Import> it(m_imports->all());
it.toBack();
while (it.hasPrevious()) {
const Import &i = it.previous();
const QList<Import> &imports = m_imports->all();
for (int pos = imports.size(); --pos >= 0; ) {
const Import &i = imports.at(pos);
const ObjectValue *import = i.object;
const ImportInfo &info = i.info;
@@ -2505,10 +2497,8 @@ ImportInfo Imports::info(const QString &name, const Context *context) const
if (dotIdx != -1)
firstId = firstId.left(dotIdx);
QListIterator<Import> it(m_imports);
it.toBack();
while (it.hasPrevious()) {
const Import &i = it.previous();
for (int pos = m_imports.size(); --pos >= 0; ) {
const Import &i = m_imports.at(pos);
const ObjectValue *import = i.object;
const ImportInfo &info = i.info;
@@ -2531,10 +2521,8 @@ ImportInfo Imports::info(const QString &name, const Context *context) const
QString Imports::nameForImportedObject(const ObjectValue *value, const Context *context) const
{
QListIterator<Import> it(m_imports);
it.toBack();
while (it.hasPrevious()) {
const Import &i = it.previous();
for (int pos = m_imports.size(); --pos >= 0; ) {
const Import &i = m_imports.at(pos);
const ObjectValue *import = i.object;
const ImportInfo &info = i.info;
@@ -2617,10 +2605,8 @@ public:
void Imports::dump() const
{
qCDebug(qmljsLog) << "Imports contents, in search order:";
QListIterator<Import> it(m_imports);
it.toBack();
while (it.hasPrevious()) {
const Import &i = it.previous();
for (int pos = m_imports.size(); --pos >= 0; ) {
const Import &i = m_imports.at(pos);
const ObjectValue *import = i.object;
const ImportInfo &info = i.info;

View File

@@ -143,23 +143,18 @@ Link::Link(const Snapshot &snapshot, const ViewerContext &vContext, const Librar
ModelManagerInterface *modelManager = ModelManagerInterface::instance();
if (modelManager) {
ModelManagerInterface::CppDataHash cppDataHash = modelManager->cppData();
const ModelManagerInterface::CppDataHash cppDataHash = modelManager->cppData();
{
// populate engine with types from C++
ModelManagerInterface::CppDataHashIterator cppDataHashIterator(cppDataHash);
while (cppDataHashIterator.hasNext()) {
cppDataHashIterator.next();
d->valueOwner->cppQmlTypes().load(cppDataHashIterator.key(),
cppDataHashIterator.value().exportedTypes);
}
for (auto it = cppDataHash.cbegin(), end = cppDataHash.cend(); it != end; ++it)
d->valueOwner->cppQmlTypes().load(it.key(), it.value().exportedTypes);
}
// build an object with the context properties from C++
ObjectValue *cppContextProperties = d->valueOwner->newObject(/* prototype = */ 0);
foreach (const ModelManagerInterface::CppData &cppData, cppDataHash) {
QHashIterator<QString, QString> it(cppData.contextProperties);
while (it.hasNext()) {
it.next();
for (const ModelManagerInterface::CppData &cppData : cppDataHash) {
for (auto it = cppData.contextProperties.cbegin(), end = cppData.contextProperties.cend();
it != end; ++it) {
const Value *value = 0;
const QString cppTypeName = it.value();
if (!cppTypeName.isEmpty())
@@ -332,10 +327,8 @@ Import LinkPrivate::importFileOrDirectory(Document::Ptr doc, const ImportInfo &i
importLibrary(doc, path, &import);
QMapIterator<QString,QStringList> iter(ModelManagerInterface::instance()
->filesInQrcPath(path));
while (iter.hasNext()) {
iter.next();
const QMap<QString, QStringList> paths = ModelManagerInterface::instance()->filesInQrcPath(path);
for (auto iter = paths.cbegin(), end = paths.cend(); iter != end; ++iter) {
if (ModelManagerInterface::guessLanguageOfFile(iter.key()).isQmlLikeLanguage()) {
Document::Ptr importedDoc = snapshot.document(iter.value().at(0));
if (importedDoc && importedDoc->bind()->rootObjectValue()) {

View File

@@ -175,15 +175,10 @@ Dialect ModelManagerInterface::guessLanguageOfFile(const QString &fileName)
QStringList ModelManagerInterface::globPatternsForLanguages(const QList<Dialect> languages)
{
QHash<QString, Dialect> lMapping;
if (instance())
lMapping = instance()->languageForSuffix();
else
lMapping = defaultLanguageMapping();
QStringList patterns;
QHashIterator<QString,Dialect> i(lMapping);
while (i.hasNext()) {
i.next();
const QHash<QString, Dialect> lMapping =
instance() ? instance()->languageForSuffix() : defaultLanguageMapping();
for (auto i = lMapping.cbegin(), end = lMapping.cend(); i != end; ++i) {
if (languages.contains(i.value()))
patterns << QLatin1String("*.") + i.key();
}
@@ -725,9 +720,8 @@ static void findNewFileImports(const Document::Ptr &doc, const Snapshot &snapsho
*importedFiles += importPath;
}
} else if (import.type() == ImportType::QrcDirectory) {
QMapIterator<QString,QStringList> dirContents(ModelManagerInterface::instance()->filesInQrcPath(importName));
while (dirContents.hasNext()) {
dirContents.next();
const QMap<QString, QStringList> files = ModelManagerInterface::instance()->filesInQrcPath(importName);
for (auto dirContents = files.cbegin(), end = files.cend(); dirContents != end; ++dirContents) {
if (ModelManagerInterface::guessLanguageOfFile(dirContents.key()).isQmlLikeOrJsLanguage()) {
foreach (const QString &filePath, dirContents.value()) {
if (! snapshot.document(filePath))
@@ -1091,10 +1085,7 @@ void ModelManagerInterface::updateImportPaths()
PathsAndLanguages allImportPaths;
QmlLanguageBundles activeBundles;
QmlLanguageBundles extendedBundles;
QMapIterator<ProjectExplorer::Project *, ProjectInfo> pInfoIter(m_projects);
QHashIterator<Dialect, QmlJS::ViewerContext> vCtxsIter = m_defaultVContexts;
while (pInfoIter.hasNext()) {
pInfoIter.next();
for (auto pInfoIter = m_projects.cbegin(), end = m_projects.cend(); pInfoIter != end; ++pInfoIter) {
const PathsAndLanguages &iPaths = pInfoIter.value().importPaths;
for (int i = 0; i < iPaths.size(); ++i) {
PathAndLanguage pAndL = iPaths.at(i);
@@ -1104,14 +1095,12 @@ void ModelManagerInterface::updateImportPaths()
pAndL.language());
}
}
while (vCtxsIter.hasNext()) {
vCtxsIter.next();
for (auto vCtxsIter = m_defaultVContexts.cbegin(), end = m_defaultVContexts.cend();
vCtxsIter != end; ++ vCtxsIter) {
foreach (const QString &path, vCtxsIter.value().paths)
allImportPaths.maybeInsert(Utils::FilePath::fromString(path), vCtxsIter.value().language);
}
pInfoIter.toFront();
while (pInfoIter.hasNext()) {
pInfoIter.next();
for (auto pInfoIter = m_projects.cbegin(), end = m_projects.cend(); pInfoIter != end; ++pInfoIter) {
activeBundles.mergeLanguageBundles(pInfoIter.value().activeBundle);
foreach (Dialect l, pInfoIter.value().activeBundle.languages()) {
foreach (const QString &path, pInfoIter.value().activeBundle.bundleForLanguage(l)
@@ -1122,9 +1111,7 @@ void ModelManagerInterface::updateImportPaths()
}
}
}
pInfoIter.toFront();
while (pInfoIter.hasNext()) {
pInfoIter.next();
for (auto pInfoIter = m_projects.cbegin(), end = m_projects.cend(); pInfoIter != end; ++pInfoIter) {
QString pathAtt = pInfoIter.value().qtQmlPath;
if (!pathAtt.isEmpty())
allImportPaths.maybeInsert(Utils::FilePath::fromString(pathAtt), Dialect::QmlQtQuick2);

View File

@@ -132,7 +132,6 @@ public:
};
typedef QHash<QString, CppData> CppDataHash;
typedef QHashIterator<QString, CppData> CppDataHashIterator;
public:
ModelManagerInterface(QObject *parent = nullptr);

View File

@@ -53,11 +53,9 @@ static bool overlaps(int posA, int lengthA, int posB, int lengthB) {
}
}
bool ChangeSet::hasOverlap(int pos, int length)
bool ChangeSet::hasOverlap(int pos, int length) const
{
QListIterator<EditOp> i(m_operationList);
while (i.hasNext()) {
const EditOp &cmd = i.next();
for (const EditOp &cmd : m_operationList) {
switch (cmd.type) {
case EditOp::Replace:
@@ -251,9 +249,7 @@ void ChangeSet::doReplace(const EditOp &op, QList<EditOp> *replaceList)
Q_ASSERT(op.type == EditOp::Replace);
{
QMutableListIterator<EditOp> i(*replaceList);
while (i.hasNext()) {
EditOp &c = i.next();
for (EditOp &c : *replaceList) {
if (op.pos1 <= c.pos1)
c.pos1 += op.text.size();
if (op.pos1 < c.pos1)

View File

@@ -105,7 +105,7 @@ private:
bool flip_helper(int pos1, int length1, int pos2, int length2);
bool copy_helper(int pos, int length, int to);
bool hasOverlap(int pos, int length);
bool hasOverlap(int pos, int length) const;
QString textAt(int pos, int length);
void doReplace(const EditOp &replace, QList<EditOp> *replaceList);

View File

@@ -468,12 +468,9 @@ void FancyMainWindow::handleVisibilityChanged(bool visible)
void FancyMainWindow::saveSettings(QSettings *settings) const
{
QHash<QString, QVariant> hash = saveSettings();
QHashIterator<QString, QVariant> it(hash);
while (it.hasNext()) {
it.next();
const QHash<QString, QVariant> hash = saveSettings();
for (auto it = hash.cbegin(), end = hash.cend(); it != end; ++it)
settings->setValue(it.key(), it.value());
}
}
void FancyMainWindow::restoreSettings(const QSettings *settings)

View File

@@ -313,11 +313,8 @@ QVariant MacroExpander::expandVariant(const QVariant &v) const
} else if (type == QMetaType::QVariantMap) {
const auto map = v.toMap();
QVariantMap result;
QMapIterator<QString, QVariant> it(map);
while (it.hasNext()) {
it.next();
for (auto it = map.cbegin(), end = map.cend(); it != end; ++it)
result.insert(it.key(), expandVariant(it.value()));
}
return result;
}
return v;

View File

@@ -181,10 +181,9 @@ void MimeAllGlobPatterns::addGlob(const MimeGlobPattern &glob)
void MimeAllGlobPatterns::removeMimeType(const QString &mimeType)
{
QMutableHashIterator<QString, QStringList> it(m_fastPatterns);
while (it.hasNext()) {
it.next().value().removeAll(mimeType);
}
for (QStringList &x : m_fastPatterns)
x.removeAll(mimeType);
m_highWeightGlobs.removeMimeType(mimeType);
m_lowWeightGlobs.removeMimeType(mimeType);
}

View File

@@ -114,11 +114,10 @@ public:
*/
void removeMimeType(const QString &mimeType)
{
QMutableListIterator<MimeGlobPattern> it(*this);
while (it.hasNext()) {
if (it.next().mimeType() == mimeType)
it.remove();
}
auto isMimeTypeEqual = [&mimeType](const MimeGlobPattern &pattern) {
return pattern.mimeType() == mimeType;
};
erase(std::remove_if(begin(), end(), isMimeTypeEqual), end());
}
void match(MimeGlobMatchResult &result, const QString &fileName) const;

View File

@@ -767,13 +767,12 @@ void MimeXMLProvider::setGlobPatternsForMimeType(const MimeType &mimeType, const
void MimeXMLProvider::setMagicRulesForMimeType(const MimeType &mimeType, const QMap<int, QList<MimeMagicRule> > &rules)
{
// remove all previous rules
QMutableListIterator<MimeMagicRuleMatcher> matcherIt(m_magicMatchers);
while (matcherIt.hasNext()) {
if (matcherIt.next().mimetype() == mimeType.name())
matcherIt.remove();
for (int i = 0; i < m_magicMatchers.size(); ++i) {
if (m_magicMatchers.at(i).mimetype() == mimeType.name())
m_magicMatchers.removeAt(i--);
}
// add new rules
for (auto it = rules.constBegin(); it != rules.constEnd(); ++it) {
for (auto it = rules.cbegin(); it != rules.cend(); ++it) {
MimeMagicRuleMatcher matcher(mimeType.name(), it.key()/*priority*/);
matcher.addRules(it.value());
addMagicMatcher(matcher);
@@ -804,15 +803,14 @@ void MimeXMLProvider::ensureLoaded()
// add custom mime types first, which override any default from freedesktop.org.xml
MimeTypeParser parser(*this);
QHashIterator<QString, QByteArray> it(m_additionalData);
while (it.hasNext()) {
it.next();
for (auto it = m_additionalData.constBegin(), end = m_additionalData.constEnd(); it != end; ++it) {
QString errorMessage;
if (!parser.parse(it.value(), it.key(), &errorMessage)) {
qWarning("MimeDatabase: Error loading %s\n%s", qPrintable(it.key()),
qPrintable(errorMessage));
}
}
foreach (const QString &file, allFiles)
load(file);
}

View File

@@ -86,15 +86,18 @@ void BackendReceiver::addExpectedCompletionsMessage(
void BackendReceiver::deleteProcessorsOfEditorWidget(TextEditor::TextEditorWidget *textEditorWidget)
{
QMutableHashIterator<quint64, ClangCompletionAssistProcessor *> it(m_assistProcessorsTable);
while (it.hasNext()) {
it.next();
QList<quint64> toRemove;
for (auto it = m_assistProcessorsTable.cbegin(), end = m_assistProcessorsTable.cend();
it != end; ++it)
{
ClangCompletionAssistProcessor *assistProcessor = it.value();
if (assistProcessor->textEditorWidget() == textEditorWidget) {
delete assistProcessor;
it.remove();
toRemove.append(it.key());
}
}
for (quint64 item : toRemove)
m_assistProcessorsTable.remove(item);
}
QFuture<CppTools::CursorInfo> BackendReceiver::addExpectedReferencesMessage(

View File

@@ -35,7 +35,6 @@ namespace ClangCodeModel {
namespace Internal {
using FileToFixits = QMap<QString, QVector<ClangBackEnd::FixItContainer>>;
using FileToFixitsIterator = QMapIterator<QString, QVector<ClangBackEnd::FixItContainer>>;
using RefactoringFilePtr = QSharedPointer<TextEditor::RefactoringFile>;
ClangFixItOperation::ClangFixItOperation(
@@ -75,9 +74,7 @@ void ClangFixItOperation::perform()
const TextEditor::RefactoringChanges refactoringChanges;
const FileToFixits fileToFixIts = fixitsPerFile(fixItContainers);
FileToFixitsIterator i(fileToFixIts);
while (i.hasNext()) {
i.next();
for (auto i = fileToFixIts.cbegin(), end = fileToFixIts.cend(); i != end; ++i) {
const QString filePath = i.key();
const QVector<ClangBackEnd::FixItContainer> fixits = i.value();

View File

@@ -356,9 +356,7 @@ void ClangToolRunControl::start()
void ClangToolRunControl::stop()
{
QSetIterator<ClangToolRunner *> i(m_runners);
while (i.hasNext()) {
ClangToolRunner *runner = i.next();
for (ClangToolRunner *runner : m_runners) {
QObject::disconnect(runner, nullptr, this, nullptr);
delete runner;
}

View File

@@ -276,9 +276,7 @@ void ActionContainerPrivate::addMenu(ActionContainer *before, ActionContainer *m
auto containerPrivate = static_cast<ActionContainerPrivate *>(menu);
QTC_ASSERT(containerPrivate->canBeAddedToContainer(this), return);
QMutableListIterator<Group> it(m_groups);
while (it.hasNext()) {
Group &group = it.next();
for (Group &group : m_groups) {
const int insertionPoint = group.items.indexOf(before);
if (insertionPoint >= 0) {
group.items.insert(insertionPoint, menu);
@@ -319,9 +317,7 @@ Command *ActionContainerPrivate::addSeparator(const Context &context, Id group,
void ActionContainerPrivate::clear()
{
QMutableListIterator<Group> it(m_groups);
while (it.hasNext()) {
Group &group = it.next();
for (Group &group : m_groups) {
foreach (QObject *item, group.items) {
if (auto command = qobject_cast<Command *>(item)) {
removeAction(command);
@@ -343,9 +339,7 @@ void ActionContainerPrivate::clear()
void ActionContainerPrivate::itemDestroyed()
{
QObject *obj = sender();
QMutableListIterator<Group> it(m_groups);
while (it.hasNext()) {
Group &group = it.next();
for (Group &group : m_groups) {
if (group.items.removeAll(obj) > 0)
break;
}
@@ -454,9 +448,7 @@ bool MenuActionContainer::updateInternal()
bool hasitems = false;
QList<QAction *> actions = m_menu->actions();
QListIterator<Group> it(m_groups);
while (it.hasNext()) {
const Group &group = it.next();
for (const Group &group : m_groups) {
foreach (QObject *item, group.items) {
if (auto container = qobject_cast<ActionContainerPrivate*>(item)) {
actions.removeAll(container->menu()->menuAction());

View File

@@ -325,14 +325,13 @@ void Action::addOverrideAction(QAction *action, const Context &context, bool scr
void Action::removeOverrideAction(QAction *action)
{
QMutableMapIterator<Id, QPointer<QAction> > it(m_contextActionMap);
while (it.hasNext()) {
it.next();
if (it.value() == nullptr)
it.remove();
else if (it.value() == action)
it.remove();
QList<Id> toRemove;
for (auto it = m_contextActionMap.cbegin(), end = m_contextActionMap.cend(); it != end; ++it) {
if (it.value() == nullptr || it.value() == action)
toRemove.append(it.key());
}
for (Id id : toRemove)
m_contextActionMap.remove(id);
setCurrentContext(m_context);
}

View File

@@ -58,11 +58,8 @@ ExternalToolModel::ExternalToolModel(QObject *parent)
ExternalToolModel::~ExternalToolModel()
{
QMapIterator<QString, QList<ExternalTool *> > it(m_tools);
while (it.hasNext()) {
it.next();
qDeleteAll(it.value());
}
for (QList<ExternalTool *> &toolInCategory : m_tools)
qDeleteAll(toolInCategory);
}
Qt::DropActions ExternalToolModel::supportedDropActions() const
@@ -192,10 +189,8 @@ QModelIndex ExternalToolModel::parent(const QModelIndex &child) const
{
if (ExternalTool *tool = toolForIndex(child)) {
int categoryIndex = 0;
QMapIterator<QString, QList<ExternalTool *> > it(m_tools);
while (it.hasNext()) {
it.next();
if (it.value().contains(tool))
for (const QList<ExternalTool *> &toolsInCategory : m_tools) {
if (toolsInCategory.contains(tool))
return index(categoryIndex, 0);
++categoryIndex;
}
@@ -376,10 +371,7 @@ void ExternalToolModel::removeTool(const QModelIndex &modelIndex)
QTC_ASSERT(!tool->preset(), return);
// remove the tool and the tree item
int categoryIndex = 0;
QMutableMapIterator<QString, QList<ExternalTool *> > it(m_tools);
while (it.hasNext()) {
it.next();
QList<ExternalTool *> &items = it.value();
for (QList<ExternalTool *> &items : m_tools) {
int pos = items.indexOf(tool);
if (pos != -1) {
beginRemoveRows(index(categoryIndex, 0), pos, pos);
@@ -473,9 +465,7 @@ ExternalToolConfig::~ExternalToolConfig()
void ExternalToolConfig::setTools(const QMap<QString, QList<ExternalTool *> > &tools)
{
QMap<QString, QList<ExternalTool *> > toolsCopy;
QMapIterator<QString, QList<ExternalTool *> > it(tools);
while (it.hasNext()) {
it.next();
for (auto it = tools.cbegin(), end = tools.cend(); it != end; ++it) {
QList<ExternalTool *> itemCopy;
for (ExternalTool *tool : it.value())
itemCopy.append(new ExternalTool(tool));

View File

@@ -427,9 +427,8 @@ void DocumentManager::renamedFile(const QString &from, const QString &to)
// gather the list of IDocuments
QList<IDocument *> documentsToRename;
QMapIterator<IDocument *, QStringList> it(d->m_documentsWithWatch);
while (it.hasNext()) {
it.next();
for (auto it = d->m_documentsWithWatch.cbegin(), end = d->m_documentsWithWatch.cend();
it != end; ++it) {
if (it.value().contains(fromKey))
documentsToRename.append(it.key());
}
@@ -1247,9 +1246,7 @@ void DocumentManager::checkForReload()
// handle deleted files
EditorManager::closeDocuments(documentsToClose, false);
QHashIterator<IDocument *, QString> it(documentsToSave);
while (it.hasNext()) {
it.next();
for (auto it = documentsToSave.cbegin(), end = documentsToSave.cend(); it != end; ++it) {
saveDocument(it.key(), it.value());
it.key()->checkPermissions();
}
@@ -1270,14 +1267,10 @@ void DocumentManager::addToRecentFiles(const QString &fileName, Id editorId)
{
if (fileName.isEmpty())
return;
QString fileKey = filePathKey(fileName, KeepLinks);
QMutableListIterator<RecentFile > it(d->m_recentFiles);
while (it.hasNext()) {
RecentFile file = it.next();
QString recentFileKey(filePathKey(file.first, DocumentManager::KeepLinks));
if (fileKey == recentFileKey)
it.remove();
}
const QString fileKey = filePathKey(fileName, KeepLinks);
Utils::erase(d->m_recentFiles, [fileKey](const RecentFile &file) {
return fileKey == filePathKey(file.first, DocumentManager::KeepLinks);
});
while (d->m_recentFiles.count() >= EditorManagerPrivate::maxRecentFiles())
d->m_recentFiles.removeLast();
d->m_recentFiles.prepend(RecentFile(fileName, editorId));
@@ -1325,15 +1318,15 @@ void readSettings()
QSettings *s = ICore::settings();
d->m_recentFiles.clear();
s->beginGroup(QLatin1String(settingsGroupC));
QStringList recentFiles = s->value(QLatin1String(filesKeyC)).toStringList();
QStringList recentEditorIds = s->value(QLatin1String(editorsKeyC)).toStringList();
const QStringList recentFiles = s->value(QLatin1String(filesKeyC)).toStringList();
const QStringList recentEditorIds = s->value(QLatin1String(editorsKeyC)).toStringList();
s->endGroup();
// clean non-existing files
QStringListIterator ids(recentEditorIds);
foreach (const QString &fileName, recentFiles) {
for (int i = 0, n = recentFiles.size(); i < n; ++i) {
const QString &fileName = recentFiles.at(i);
QString editorId;
if (ids.hasNext()) // guard against old or weird settings
editorId = ids.next();
if (i < recentEditorIds.size()) // guard against old or weird settings
editorId = recentEditorIds.at(i);
if (QFileInfo(fileName).isFile())
d->m_recentFiles.append(DocumentManager::RecentFile(QDir::fromNativeSeparators(fileName), // from native to guard against old settings
Id::fromString(editorId)));

View File

@@ -98,11 +98,8 @@ ExternalToolManager::ExternalToolManager()
true);
QMap<QString, QList<ExternalTool *> > categoryMap;
QMapIterator<QString, QMultiMap<int, ExternalTool*> > it(categoryPriorityMap);
while (it.hasNext()) {
it.next();
for (auto it = categoryPriorityMap.cbegin(), end = categoryPriorityMap.cend(); it != end; ++it)
categoryMap.insert(it.key(), it.value().values());
}
// read renamed categories and custom order
readSettings(tools, &categoryMap);
@@ -177,9 +174,7 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<ExternalT
// delete old tools and create list of new ones
QMap<QString, ExternalTool *> newTools;
QMap<QString, QAction *> newActions;
QMapIterator<QString, QList<ExternalTool *> > it(tools);
while (it.hasNext()) {
it.next();
for (auto it = tools.cbegin(), end = tools.cend(); it != end; ++it) {
foreach (ExternalTool *tool, it.value()) {
const QString id = tool->id();
if (d->m_tools.value(id) == tool) {
@@ -192,10 +187,9 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<ExternalT
}
}
qDeleteAll(d->m_tools);
QMapIterator<QString, QAction *> remainingActions(d->m_actions);
const Id externalToolsPrefix = "Tools.External.";
while (remainingActions.hasNext()) {
remainingActions.next();
for (auto remainingActions = d->m_actions.cbegin(), end = d->m_actions.cend();
remainingActions != end; ++remainingActions) {
ActionManager::unregisterAction(remainingActions.value(),
externalToolsPrefix.withSuffix(remainingActions.key()));
delete remainingActions.value();
@@ -208,9 +202,7 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<ExternalT
// create menu structure and remove no-longer used containers
// add all the category menus, QMap is nicely sorted
QMap<QString, ActionContainer *> newContainers;
it.toFront();
while (it.hasNext()) {
it.next();
for (auto it = tools.cbegin(), end = tools.cend(); it != end; ++it) {
ActionContainer *container = nullptr;
const QString &containerName = it.key();
if (containerName.isEmpty()) { // no displayCategory, so put into external tools menu directly
@@ -302,9 +294,7 @@ static void writeSettings()
settings->remove(QLatin1String(""));
settings->beginGroup(QLatin1String("OverrideCategories"));
QMapIterator<QString, QList<ExternalTool *> > it(d->m_categoryMap);
while (it.hasNext()) {
it.next();
for (auto it = d->m_categoryMap.cbegin(), end = d->m_categoryMap.cend(); it != end; ++it) {
QString category = it.key();
if (category.isEmpty())
category = QLatin1String(kSpecialUncategorizedSetting);

View File

@@ -222,12 +222,9 @@ const HelpItem::Links &HelpItem::links() const
}
}
}
QMapIterator<QString, QUrl> it(helpLinks);
while (it.hasNext()) {
it.next();
for (auto it = helpLinks.cbegin(), end = helpLinks.cend(); it != end; ++it)
m_helpLinks->emplace_back(it.key(), it.value());
}
}
Utils::sort(*m_helpLinks, linkLessThan);
}
return *m_helpLinks;

View File

@@ -508,11 +508,9 @@ void ProgressManagerPrivate::updateSummaryProgressBar()
stopFadeOfSummaryProgress();
m_summaryProgressBar->setFinished(false);
QMapIterator<QFutureWatcher<void> *, Id> it(m_runningTasks);
static const int TASK_RANGE = 100;
int value = 0;
while (it.hasNext()) {
it.next();
for (auto it = m_runningTasks.cbegin(), end = m_runningTasks.cend(); it != end; ++it) {
QFutureWatcher<void> *watcher = it.key();
int min = watcher->progressMinimum();
int range = watcher->progressMaximum() - min;

View File

@@ -241,9 +241,8 @@ QStringList SettingsDatabase::childKeys() const
QStringList children;
const QString g = group();
QMapIterator<QString, QVariant> i(d->m_settings);
while (i.hasNext()) {
const QString &key = i.next().key();
for (auto i = d->m_settings.cbegin(), end = d->m_settings.cend(); i != end; ++i) {
const QString &key = i.key();
if (key.startsWith(g) && key.indexOf(QLatin1Char('/'), g.length() + 1) == -1)
children.append(key.mid(g.length() + 1));
}

View File

@@ -108,9 +108,7 @@ SideBar::~SideBar()
QString SideBar::idForTitle(const QString &title) const
{
QMapIterator<QString, QPointer<SideBarItem> > iter(d->m_itemMap);
while (iter.hasNext()) {
iter.next();
for (auto iter = d->m_itemMap.cbegin(), end = d->m_itemMap.cend(); iter != end; ++iter) {
if (iter.value().data()->title() == title)
return iter.key();
}
@@ -266,11 +264,8 @@ void SideBar::saveSettings(QSettings *settings, const QString &name)
if (!currentItemId.isEmpty())
views.append(currentItemId);
}
if (views.isEmpty() && d->m_itemMap.size()) {
QMapIterator<QString, QPointer<SideBarItem> > iter(d->m_itemMap);
iter.next();
views.append(iter.key());
}
if (views.isEmpty() && !d->m_itemMap.isEmpty())
views.append(d->m_itemMap.cbegin().key());
settings->setValue(prefix + QLatin1String("Views"), views);
settings->setValue(prefix + QLatin1String("Visible"),

View File

@@ -103,9 +103,7 @@ static QString findUnusedId(const QString &proposal, const QMap<QString, QList<E
result = proposal + (number > 0 ? QString::number(number) : QString::fromLatin1(""));
++number;
found = false;
QMapIterator<QString, QList<ExternalTool *> > it(tools);
while (!found && it.hasNext()) {
it.next();
for (auto it = tools.cbegin(), end = tools.cend(); it != end; ++it) {
foreach (ExternalTool *tool, it.value()) {
if (tool->id() == result) {
found = true;
@@ -125,9 +123,7 @@ void ToolSettings::apply()
QMap<QString, ExternalTool *> originalTools = ExternalToolManager::toolsById();
QMap<QString, QList<ExternalTool *> > newToolsMap = m_widget->tools();
QMap<QString, QList<ExternalTool *> > resultMap;
QMapIterator<QString, QList<ExternalTool *> > it(newToolsMap);
while (it.hasNext()) {
it.next();
for (auto it = newToolsMap.cbegin(), end = newToolsMap.cend(); it != end; ++it) {
QList<ExternalTool *> items;
foreach (ExternalTool *tool, it.value()) {
ExternalTool *toolToAdd = nullptr;

View File

@@ -1254,9 +1254,8 @@ void WorkingCopyModel::configure(const WorkingCopy &workingCopy)
{
emit layoutAboutToBeChanged();
m_workingCopyList.clear();
QHashIterator<Utils::FilePath, QPair<QByteArray, unsigned> > it = workingCopy.iterator();
while (it.hasNext()) {
it.next();
const WorkingCopy::Table &elements = workingCopy.elements();
for (auto it = elements.cbegin(), end = elements.cend(); it != end; ++it) {
m_workingCopyList << WorkingCopyEntry(it.key().toString(), it.value().first,
it.value().second);
}

View File

@@ -878,9 +878,8 @@ ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targetOffse
const LocalSymbols localSymbols(targetFile->cppDocument(), targetDefinition);
const int endOfArguments = targetFile->endOf(targetFunctionDeclarator->rparen_token);
QHashIterator<Symbol *, QString> it(renamedTargetParameters);
while (it.hasNext()) {
it.next();
for (auto it = renamedTargetParameters.cbegin(), end = renamedTargetParameters.cend();
it != end; ++it) {
const QList<SemanticInfo::Use> &uses = localSymbols.uses.value(it.key());
foreach (const SemanticInfo::Use &use, uses) {
if (use.isInvalid())

View File

@@ -3729,10 +3729,8 @@ void ExtractFunction::match(const CppQuickFixInterface &interface, QuickFixOpera
// Identify what would be parameters for the new function and its return value, if any.
Symbol *funcReturn = nullptr;
QList<QPair<QString, QString> > relevantDecls;
SemanticInfo::LocalUseIterator it(interface.semanticInfo().localUses);
while (it.hasNext()) {
it.next();
const SemanticInfo::LocalUseMap &localUses = interface.semanticInfo().localUses;
for (auto it = localUses.cbegin(), end = localUses.cend(); it != end; ++it) {
bool usedBeforeExtraction = false;
bool usedAfterExtraction = false;
bool usedInsideExtraction = false;

View File

@@ -205,9 +205,7 @@ private:
LookupContext context(m_document, m_snapshot);
CppTools::SemanticInfo::LocalUseIterator it(uses);
while (it.hasNext()) {
it.next();
for (auto it = uses.cbegin(), end = uses.cend(); it != end; ++it) {
const SemanticUses &uses = it.value();
bool good = false;

View File

@@ -618,9 +618,8 @@ void Dumper::dumpWorkingCopy(const WorkingCopy &workingCopy)
m_out << "Working Copy contains " << workingCopy.size() << " entries{{{1\n";
const QByteArray i1 = indent(1);
QHashIterator< ::Utils::FilePath, QPair<QByteArray, unsigned> > it = workingCopy.iterator();
while (it.hasNext()) {
it.next();
const WorkingCopy::Table &elements = workingCopy.elements();
for (auto it = elements.cbegin(), end = elements.cend(); it != end; ++it) {
const ::Utils::FilePath &filePath = it.key();
unsigned sourcRevision = it.value().second;
m_out << i1 << "rev=" << sourcRevision << ", " << filePath << "\n";

View File

@@ -93,9 +93,7 @@ struct Result
{
QList<Result> result;
CppTools::SemanticInfo::LocalUseIterator it(localUses);
while (it.hasNext()) {
it.next();
for (auto it = localUses.cbegin(), end = localUses.cend(); it != end; ++it) {
const CPlusPlus::Symbol *symbol = it.key();
const QList<CppTools::SemanticInfo::Use> &uses = it.value();
foreach (const CppTools::SemanticInfo::Use &use, uses)

View File

@@ -103,10 +103,7 @@ QList<IndexItem::Ptr> CppLocatorData::allIndexItems(
const QHash<QString, QList<IndexItem::Ptr>> &items) const
{
QList<IndexItem::Ptr> result;
QHashIterator<QString, QList<IndexItem::Ptr> > it(items);
while (it.hasNext()) {
it.next();
result.append(it.value());
}
for (const QList<IndexItem::Ptr> &subItems : items)
result.append(subItems);
return result;
}

View File

@@ -608,10 +608,7 @@ void CppModelManager::ensureUpdated()
QStringList CppModelManager::internalProjectFiles() const
{
QStringList files;
QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(d->m_projectToProjectsInfo);
while (it.hasNext()) {
it.next();
const ProjectInfo pinfo = it.value();
for (const ProjectInfo &pinfo : d->m_projectToProjectsInfo) {
foreach (const ProjectPart::Ptr &part, pinfo.projectParts()) {
foreach (const ProjectFile &file, part->files)
files += file.path;
@@ -624,10 +621,7 @@ QStringList CppModelManager::internalProjectFiles() const
ProjectExplorer::HeaderPaths CppModelManager::internalHeaderPaths() const
{
ProjectExplorer::HeaderPaths headerPaths;
QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(d->m_projectToProjectsInfo);
while (it.hasNext()) {
it.next();
const ProjectInfo pinfo = it.value();
for (const ProjectInfo &pinfo : d->m_projectToProjectsInfo) {
foreach (const ProjectPart::Ptr &part, pinfo.projectParts()) {
foreach (const ProjectExplorer::HeaderPath &path, part->headerPaths) {
ProjectExplorer::HeaderPath hp(QDir::cleanPath(path.path), path.type);
@@ -655,10 +649,7 @@ ProjectExplorer::Macros CppModelManager::internalDefinedMacros() const
{
ProjectExplorer::Macros macros;
QSet<ProjectExplorer::Macro> alreadyIn;
QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(d->m_projectToProjectsInfo);
while (it.hasNext()) {
it.next();
const ProjectInfo pinfo = it.value();
for (const ProjectInfo &pinfo : d->m_projectToProjectsInfo) {
for (const ProjectPart::Ptr &part : pinfo.projectParts()) {
addUnique(part->toolChainMacros, macros, alreadyIn);
addUnique(part->projectMacros, macros, alreadyIn);
@@ -783,11 +774,8 @@ WorkingCopy CppModelManager::buildWorkingCopyList()
cppEditorDocument->revision());
}
QSetIterator<AbstractEditorSupport *> it(d->m_extraEditorSupports);
while (it.hasNext()) {
AbstractEditorSupport *es = it.next();
for (AbstractEditorSupport *es : qAsConst(d->m_extraEditorSupports))
workingCopy.insert(es->fileName(), es->contents(), es->revision());
}
// Add the project configuration file
QByteArray conf = codeModelConfiguration();
@@ -815,9 +803,7 @@ static QSet<QString> tooBigFilesRemoved(const QSet<QString> &files, int fileSize
QSet<QString> result;
QFileInfo fileInfo;
QSetIterator<QString> i(files);
while (i.hasNext()) {
const QString filePath = i.next();
for (const QString &filePath : files) {
fileInfo.setFile(filePath);
if (fileSizeExceedsLimit(fileInfo, fileSizeLimitInMb))
continue;
@@ -887,9 +873,8 @@ QList<CppEditorDocumentHandle *> CppModelManager::cppEditorDocuments() const
void CppModelManager::removeFilesFromSnapshot(const QSet<QString> &filesToRemove)
{
QMutexLocker snapshotLocker(&d->m_snapshotMutex);
QSetIterator<QString> i(filesToRemove);
while (i.hasNext())
d->m_snapshot.remove(i.next());
for (const QString &file : filesToRemove)
d->m_snapshot.remove(file);
}
class ProjectInfoComparer
@@ -935,9 +920,7 @@ public:
commonSourceFiles.intersect(m_oldSourceFiles);
QList<Document::Ptr> documentsToCheck;
QSetIterator<QString> i(commonSourceFiles);
while (i.hasNext()) {
const QString file = i.next();
for (const QString &file : commonSourceFiles) {
if (Document::Ptr document = snapshot.document(file))
documentsToCheck << document;
}

View File

@@ -618,11 +618,10 @@ void CppToolsPlugin::test_modelmanager_extraeditorsupport_uiFiles()
QCOMPARE(workingCopy.size(), 2); // mm->configurationFileName() and "ui_*.h"
QStringList fileNamesInWorkinCopy;
QHashIterator<Utils::FilePath, QPair<QByteArray, unsigned> > it = workingCopy.iterator();
while (it.hasNext()) {
it.next();
const WorkingCopy::Table &elements = workingCopy.elements();
for (auto it = elements.cbegin(), end = elements.cend(); it != end; ++it)
fileNamesInWorkinCopy << Utils::FilePath::fromString(it.key().toString()).fileName();
}
fileNamesInWorkinCopy.sort();
const QString expectedUiHeaderFileName = _("ui_mainwindow.h");
QCOMPARE(fileNamesInWorkinCopy.at(0), mm->configurationFileName());

View File

@@ -62,7 +62,6 @@ public:
public:
using Use = TextEditor::HighlightingResult;
using LocalUseMap = QHash<CPlusPlus::Symbol *, QList<Use>>;
using LocalUseIterator = QHashIterator<CPlusPlus::Symbol *, QList<Use>>;
// Document specific
unsigned revision = 0;

View File

@@ -70,14 +70,14 @@ public:
QPair<QByteArray, unsigned> get(const Utils::FilePath &fileName) const
{ return _elements.value(fileName); }
QHashIterator<Utils::FilePath, QPair<QByteArray, unsigned> > iterator() const
{ return QHashIterator<Utils::FilePath, QPair<QByteArray, unsigned> >(_elements); }
using Table = QHash<Utils::FilePath, QPair<QByteArray, unsigned> >;
const Table &elements() const
{ return _elements; }
int size() const
{ return _elements.size(); }
private:
using Table = QHash<Utils::FilePath, QPair<QByteArray, unsigned> >;
Table _elements;
};

View File

@@ -2048,9 +2048,7 @@ void GdbEngine::setTokenBarrier()
{
//QTC_ASSERT(m_nonDiscardableCount == 0, /**/);
bool good = true;
QHashIterator<int, DebuggerCommand> it(m_commandForToken);
while (it.hasNext()) {
it.next();
for (auto it = m_commandForToken.cbegin(), end = m_commandForToken.cend(); it != end; ++it) {
if (!(m_flagsForToken.value(it.key()) & Discardable)) {
qDebug() << "TOKEN: " << it.key() << "CMD:" << it.value().function;
good = false;

View File

@@ -886,12 +886,10 @@ static ConsoleItem *constructLogItemTree(const QVariant &result,
else
text = key + " : Object";
QMap<QString, QVariant> resultMap = result.toMap();
const QMap<QString, QVariant> resultMap = result.toMap();
QVarLengthArray<ConsoleItem *> children(resultMap.size());
QMapIterator<QString, QVariant> i(result.toMap());
auto it = children.begin();
while (i.hasNext()) {
i.next();
for (auto i = resultMap.cbegin(), end = resultMap.cend(); i != end; ++i) {
*(it++) = constructLogItemTree(i.value(), i.key());
}

View File

@@ -220,18 +220,14 @@ static void saveWatchers()
static void loadFormats()
{
QVariant value = SessionManager::value("DefaultFormats");
QMapIterator<QString, QVariant> it(value.toMap());
while (it.hasNext()) {
it.next();
QMap<QString, QVariant> value = SessionManager::value("DefaultFormats").toMap();
for (auto it = value.cbegin(), end = value.cend(); it != end; ++it) {
if (!it.key().isEmpty())
theTypeFormats.insert(it.key(), it.value().toInt());
}
value = SessionManager::value("IndividualFormats");
it = QMapIterator<QString, QVariant>(value.toMap());
while (it.hasNext()) {
it.next();
value = SessionManager::value("IndividualFormats").toMap();
for (auto it = value.cbegin(), end = value.cend(); it != end; ++it) {
if (!it.key().isEmpty())
theIndividualFormats.insert(it.key(), it.value().toInt());
}
@@ -240,9 +236,7 @@ static void loadFormats()
static void saveFormats()
{
QMap<QString, QVariant> formats;
QHashIterator<QString, int> it(theTypeFormats);
while (it.hasNext()) {
it.next();
for (auto it = theTypeFormats.cbegin(), end = theTypeFormats.cend(); it != end; ++it) {
const int format = it.value();
if (format != AutomaticFormat) {
const QString key = it.key().trimmed();
@@ -253,9 +247,7 @@ static void saveFormats()
SessionManager::setValue("DefaultFormats", formats);
formats.clear();
it = QHashIterator<QString, int>(theIndividualFormats);
while (it.hasNext()) {
it.next();
for (auto it = theIndividualFormats.cbegin(), end = theIndividualFormats.cend(); it != end; ++it) {
const int format = it.value();
const QString key = it.key().trimmed();
if (!key.isEmpty())
@@ -2395,9 +2387,7 @@ QStringList WatchHandler::watchedExpressions()
{
// Filter out invalid watchers.
QStringList watcherNames;
QMapIterator<QString, int> it(theWatcherNames);
while (it.hasNext()) {
it.next();
for (auto it = theWatcherNames.cbegin(), end = theWatcherNames.cend(); it != end; ++it) {
const QString &watcherName = it.key();
if (!watcherName.isEmpty())
watcherNames.push_back(watcherName);
@@ -2512,9 +2502,7 @@ QString WatchHandler::typeFormatRequests() const
{
QString ba;
if (!theTypeFormats.isEmpty()) {
QHashIterator<QString, int> it(theTypeFormats);
while (it.hasNext()) {
it.next();
for (auto it = theTypeFormats.cbegin(), end = theTypeFormats.cend(); it != end; ++it) {
const int format = it.value();
if (format != AutomaticFormat) {
ba.append(toHex(it.key()));
@@ -2532,9 +2520,7 @@ QString WatchHandler::individualFormatRequests() const
{
QString res;
if (!theIndividualFormats.isEmpty()) {
QHashIterator<QString, int> it(theIndividualFormats);
while (it.hasNext()) {
it.next();
for (auto it = theIndividualFormats.cbegin(), end = theIndividualFormats.cend(); it != end; ++it) {
const int format = it.value();
if (format != AutomaticFormat) {
res.append(it.key());
@@ -2548,19 +2534,16 @@ QString WatchHandler::individualFormatRequests() const
return res;
}
void WatchHandler::appendFormatRequests(DebuggerCommand *cmd)
void WatchHandler::appendFormatRequests(DebuggerCommand *cmd) const
{
QJsonArray expanded;
QSetIterator<QString> jt(m_model->m_expandedINames);
while (jt.hasNext())
expanded.append(jt.next());
for (const QString &name : qAsConst(m_model->m_expandedINames))
expanded.append(name);
cmd->arg("expanded", expanded);
QJsonObject typeformats;
QHashIterator<QString, int> it(theTypeFormats);
while (it.hasNext()) {
it.next();
for (auto it = theTypeFormats.cbegin(), end = theTypeFormats.cend(); it != end; ++it) {
const int format = it.value();
if (format != AutomaticFormat)
typeformats.insert(it.key(), format);
@@ -2568,12 +2551,10 @@ void WatchHandler::appendFormatRequests(DebuggerCommand *cmd)
cmd->arg("typeformats", typeformats);
QJsonObject formats;
QHashIterator<QString, int> it2(theIndividualFormats);
while (it2.hasNext()) {
it2.next();
const int format = it2.value();
for (auto it = theIndividualFormats.cbegin(), end = theIndividualFormats.cend(); it != end; ++it) {
const int format = it.value();
if (format != AutomaticFormat)
formats.insert(it2.key(), format);
formats.insert(it.key(), format);
}
cmd->arg("formats", formats);
}
@@ -2586,18 +2567,16 @@ static inline QJsonObject watcher(const QString &iname, const QString &exp)
return watcher;
}
void WatchHandler::appendWatchersAndTooltipRequests(DebuggerCommand *cmd)
void WatchHandler::appendWatchersAndTooltipRequests(DebuggerCommand *cmd) const
{
QJsonArray watchers;
const DebuggerToolTipContexts toolTips = m_engine->toolTipManager()->pendingTooltips();
for (const DebuggerToolTipContext &p : toolTips)
watchers.append(watcher(p.iname, p.expression));
QMapIterator<QString, int> it(WatchHandler::watcherNames());
while (it.hasNext()) {
it.next();
for (auto it = theWatcherNames.cbegin(), end = theWatcherNames.cend(); it != end; ++it)
watchers.append(watcher("watch." + QString::number(it.value()), it.key()));
}
cmd->arg("watchers", watchers);
}

View File

@@ -86,8 +86,8 @@ public:
static QStringList watchedExpressions();
static QMap<QString, int> watcherNames();
void appendFormatRequests(DebuggerCommand *cmd);
void appendWatchersAndTooltipRequests(DebuggerCommand *cmd);
void appendFormatRequests(DebuggerCommand *cmd) const;
void appendWatchersAndTooltipRequests(DebuggerCommand *cmd) const;
QString typeFormatRequests() const;
QString individualFormatRequests() const;

View File

@@ -516,13 +516,11 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
newDocTable.insert(i.value());
}
} else {
const CppTools::WorkingCopy workingCopy =
CppTools::CppModelManager::instance()->workingCopy();
const Utils::FilePath configFileName =
Utils::FilePath::fromString(CppTools::CppModelManager::configurationFileName());
QHashIterator<Utils::FilePath, QPair<QByteArray, unsigned> > it = workingCopy.iterator();
while (it.hasNext()) {
it.next();
const CppTools::WorkingCopy::Table &elements =
CppTools::CppModelManager::instance()->workingCopy().elements();
for (auto it = elements.cbegin(), end = elements.cend(); it != end; ++it) {
const Utils::FilePath &fileName = it.key();
if (fileName != configFileName)
newDocTable.insert(docTable.document(fileName));

View File

@@ -321,7 +321,6 @@ private:
QString m_fileName;
};
using Marks = QHash<QChar, Mark>;
using MarksIterator = QHashIterator<QChar, Mark>;
struct State
{
@@ -3605,8 +3604,7 @@ void FakeVimHandler::Private::updateSelection()
{
QList<QTextEdit::ExtraSelection> selections = m_extraSelections;
if (hasConfig(ConfigShowMarks)) {
for (MarksIterator it(m_buffer->marks); it.hasNext(); ) {
it.next();
for (auto it = m_buffer->marks.cbegin(), end = m_buffer->marks.cend(); it != end; ++it) {
QTextEdit::ExtraSelection sel;
sel.cursor = m_cursor;
setCursorPosition(&sel.cursor, it.value().position(document()));
@@ -5724,9 +5722,7 @@ bool FakeVimHandler::Private::handleExRegisterCommand(const ExCommand &cmd)
QByteArray regs = cmd.args.toLatin1();
if (regs.isEmpty()) {
regs = "\"0123456789";
QHashIterator<int, Register> it(g.registers);
while (it.hasNext()) {
it.next();
for (auto it = g.registers.cbegin(), end = g.registers.cend(); it != end; ++it) {
if (it.key() > '9')
regs += char(it.key());
}
@@ -8535,10 +8531,8 @@ bool FakeVimHandler::Private::jumpToMark(QChar mark, bool backTickMode)
void FakeVimHandler::Private::updateMarks(const Marks &newMarks)
{
for (MarksIterator it(newMarks); it.hasNext(); ) {
it.next();
for (auto it = newMarks.cbegin(), end = newMarks.cend(); it != end; ++it)
m_buffer->marks[it.key()] = it.value();
}
}
RangeMode FakeVimHandler::Private::registerRangeMode(int reg) const

View File

@@ -103,11 +103,9 @@ bool GerritRemoteChooser::updateRemotes(bool forceReload)
m_remoteComboBox->clear();
m_remotes.clear();
QString errorMessage; // Mute errors. We'll just fallback to the defaults
QMap<QString, QString> remotesList =
const QMap<QString, QString> remotesList =
Git::Internal::GitPlugin::client()->synchronousRemotesList(m_repository, &errorMessage);
QMapIterator<QString, QString> mapIt(remotesList);
while (mapIt.hasNext()) {
mapIt.next();
for (auto mapIt = remotesList.cbegin(), end = remotesList.cend(); mapIt != end; ++mapIt) {
GerritServer server;
if (!server.fillFromRemote(mapIt.value(), *m_parameters, forceReload))
continue;

View File

@@ -474,9 +474,8 @@ void IosConfigurations::loadProvisioningData(bool notify)
const QSettings xcodeSettings(xcodePlistPath, QSettings::NativeFormat);
const QVariantMap teamMap = xcodeSettings.value(provisioningTeamsTag).toMap();
QList<QVariantMap> teams;
QMapIterator<QString, QVariant> accountiterator(teamMap);
while (accountiterator.hasNext()) {
accountiterator.next();
for (auto accountiterator = teamMap.cbegin(), end = teamMap.cend();
accountiterator != end; ++accountiterator) {
QVariantMap teamInfo = accountiterator.value().toMap();
int provisioningTeamIsFree = teamInfo.value(freeTeamTag).toBool() ? 1 : 0;
teamInfo[freeTeamTag] = provisioningTeamIsFree;

View File

@@ -108,9 +108,7 @@ IosDevice::IosDevice(const QString &uid)
IDevice::DeviceInfo IosDevice::deviceInformation() const
{
IDevice::DeviceInfo res;
QMapIterator<QString, QString> i(m_extraInfo);
while (i.hasNext()) {
i.next();
for (auto i = m_extraInfo.cbegin(), end = m_extraInfo.cend(); i != end; ++i) {
IosDeviceManager::TranslationMap tMap = IosDeviceManager::translationMap();
if (tMap.contains(i.key()))
res.append(DeviceInfoItem(tMap.value(i.key()), tMap.value(i.value(), i.value())));
@@ -131,24 +129,19 @@ DeviceProcessSignalOperation::Ptr IosDevice::signalOperation() const
void IosDevice::fromMap(const QVariantMap &map)
{
IDevice::fromMap(map);
QVariantMap vMap = map.value(QLatin1String(Constants::EXTRA_INFO_KEY)).toMap();
QMapIterator<QString, QVariant> i(vMap);
m_extraInfo.clear();
while (i.hasNext()) {
i.next();
const QVariantMap vMap = map.value(QLatin1String(Constants::EXTRA_INFO_KEY)).toMap();
for (auto i = vMap.cbegin(), end = vMap.cend(); i != end; ++i)
m_extraInfo.insert(i.key(), i.value().toString());
}
}
QVariantMap IosDevice::toMap() const
{
QVariantMap res = IDevice::toMap();
QVariantMap vMap;
QMapIterator<QString, QString> i(m_extraInfo);
while (i.hasNext()) {
i.next();
for (auto i = m_extraInfo.cbegin(), end = m_extraInfo.cend(); i != end; ++i)
vMap.insert(i.key(), i.value());
}
res.insert(QLatin1String(Constants::EXTRA_INFO_KEY), vMap);
return res;
}

View File

@@ -76,11 +76,8 @@ void MacroEvent::save(QDataStream &stream) const
{
stream << m_id.name();
stream << m_values.count();
QMapIterator<quint8, QVariant> i(m_values);
while (i.hasNext()) {
i.next();
for (auto i = m_values.cbegin(), end = m_values.cend(); i != end; ++i)
stream << i.key() << i.value();
}
}
Core::Id MacroEvent::id() const

View File

@@ -56,10 +56,8 @@ QList<Core::LocatorFilterEntry> MacroLocatorFilter::matchesFor(QFutureInterface<
const Qt::CaseSensitivity entryCaseSensitivity = caseSensitivity(entry);
const QMap<QString, Macro*> &macros = MacroManager::macros();
QMapIterator<QString, Macro*> it(macros);
while (it.hasNext()) {
it.next();
for (auto it = macros.cbegin(), end = macros.cend(); it != end; ++it) {
const QString displayName = it.key();
const QString description = it.value()->description();

View File

@@ -88,10 +88,7 @@ void MacroOptionsWidget::createTable()
{
QDir dir(MacroManager::macrosDirectory());
const Core::Id base = Core::Id(Constants::PREFIX_MACRO);
QMapIterator<QString, Macro *> it(MacroManager::macros());
while (it.hasNext()) {
it.next();
Macro *macro = it.value();
for (Macro *macro : MacroManager::macros()) {
QFileInfo fileInfo(macro->fileName());
if (fileInfo.absoluteDir() == dir.absolutePath()) {
auto macroItem = new QTreeWidgetItem(m_ui->treeWidget);
@@ -140,11 +137,8 @@ void MacroOptionsWidget::apply()
}
// Change macro
QMapIterator<QString, QString> it(m_macroToChange);
while (it.hasNext()) {
it.next();
for (auto it = m_macroToChange.cbegin(), end = m_macroToChange.cend(); it != end; ++it)
MacroManager::instance()->changeMacro(it.key(), it.value());
}
// Reinitialize the page
initialize();

View File

@@ -54,11 +54,8 @@ QByteArray PerforceSubmitEditor::fileContents() const
const_cast<PerforceSubmitEditor*>(this)->updateEntries();
QString text;
QTextStream out(&text);
QMapIterator<QString, QString> it(m_entries);
while (it.hasNext()) {
it.next();
for (auto it = m_entries.cbegin(), end = m_entries.cend(); it != end; ++it)
out << it.key() << ":" << it.value();
}
return text.toLocal8Bit();
}

View File

@@ -40,12 +40,7 @@ CodeStyleSettingsWidget::CodeStyleSettingsWidget(Project *project) : QWidget(),
const EditorConfiguration *config = m_project->editorConfiguration();
QMap<Core::Id, ICodeStylePreferencesFactory *> factories
= TextEditorSettings::codeStyleFactories();
QMapIterator<Core::Id, ICodeStylePreferencesFactory *> it(factories);
while (it.hasNext()) {
it.next();
ICodeStylePreferencesFactory *factory = it.value();
for (ICodeStylePreferencesFactory *factory : TextEditorSettings::codeStyleFactories()) {
Core::Id languageId = factory->languageId();
ICodeStylePreferences *codeStylePreferences = config->codeStyle(languageId);

View File

@@ -86,9 +86,8 @@ struct EditorConfigurationPrivate
EditorConfiguration::EditorConfiguration() : d(std::make_unique<EditorConfigurationPrivate>())
{
const QMap<Core::Id, ICodeStylePreferences *> languageCodeStylePreferences = TextEditorSettings::codeStyles();
QMapIterator<Core::Id, ICodeStylePreferences *> itCodeStyle(languageCodeStylePreferences);
while (itCodeStyle.hasNext()) {
itCodeStyle.next();
for (auto itCodeStyle = languageCodeStylePreferences.cbegin(), end = languageCodeStylePreferences.cend();
itCodeStyle != end; ++itCodeStyle) {
Core::Id languageId = itCodeStyle.key();
// global prefs for language
ICodeStylePreferences *originalPreferences = itCodeStyle.value();
@@ -189,10 +188,11 @@ QVariantMap EditorConfiguration::toMap() const
map.insert(kCodec, d->m_textCodec->name());
map.insert(kCodeStyleCount, d->m_languageCodeStylePreferences.count());
QMapIterator<Core::Id, ICodeStylePreferences *> itCodeStyle(d->m_languageCodeStylePreferences);
int i = 0;
while (itCodeStyle.hasNext()) {
itCodeStyle.next();
for (auto itCodeStyle = d->m_languageCodeStylePreferences.cbegin(),
end = d->m_languageCodeStylePreferences.cend();
itCodeStyle != end; ++itCodeStyle) {
QVariantMap settingsIdMap;
settingsIdMap.insert(QLatin1String("language"), itCodeStyle.key().toSetting());
QVariantMap value;

View File

@@ -469,9 +469,7 @@ QVariantMap UserFileAccessor::prepareToWriteSettings(const QVariantMap &data) co
QVariantMap UserFileVersion14Upgrader::upgrade(const QVariantMap &map)
{
QVariantMap result;
QMapIterator<QString, QVariant> it(map);
while (it.hasNext()) {
it.next();
for (auto it = map.cbegin(), end = map.cend(); it != end; ++it) {
if (it.value().type() == QVariant::Map)
result.insert(it.key(), upgrade(it.value().toMap()));
else if (it.key() == "AutotoolsProjectManager.AutotoolsBuildConfiguration.BuildDirectory"

View File

@@ -814,9 +814,8 @@ static void find_helper(QFutureInterface<FindReferences::Usage> &future,
// update snapshot from workingCopy to make sure it's up to date
// ### remove?
// ### this is a great candidate for map-reduce
QHashIterator< QString, QPair<QString, int> > it(workingCopy.all());
while (it.hasNext()) {
it.next();
const ModelManagerInterface::WorkingCopy::Table &all = workingCopy.all();
for (auto it = all.cbegin(), end = all.cend(); it != end; ++it) {
const QString fileName = it.key();
Document::Ptr oldDoc = snapshot.document(fileName);
if (oldDoc && oldDoc->editorRevision() == it.value().second)

View File

@@ -139,9 +139,7 @@ public:
// handle inner ids
QString innerIdForwarders;
QHashIterator<QString, SourceLocation> it(innerIds);
while (it.hasNext()) {
it.next();
for (auto it = innerIds.cbegin(), end = innerIds.cend(); it != end; ++it) {
const QString innerId = it.key();
comment += tr("// Rename all outer uses of the id \"%1\" to \"%2.item.%1\".\n").arg(
innerId, loaderId);

View File

@@ -65,14 +65,11 @@ QList<Core::LocatorFilterEntry> FunctionFilter::matchesFor(
if (!regexp.isValid())
return goodEntries;
QHashIterator<QString, QList<LocatorData::Entry> > it(m_data->entries());
while (it.hasNext()) {
const QHash<QString, QList<LocatorData::Entry> > entries = m_data->entries();
for (const QList<LocatorData::Entry> &items : entries) {
if (future.isCanceled())
break;
it.next();
const QList<LocatorData::Entry> items = it.value();
for (const LocatorData::Entry &info : items) {
if (info.type != LocatorData::Function)
continue;

View File

@@ -152,9 +152,7 @@ bool ScreenshotCropper::saveAreasOfInterest(const QString &areasXmlFile, QMap<QS
writer.setAutoFormatting(true);
writer.writeStartDocument();
writer.writeStartElement(xmlTagAreas);
QMapIterator<QString, QRect> i(areas);
while (i.hasNext()) {
i.next();
for (auto i = areas.cbegin(), end = areas.cend(); i != end; ++i) {
writer.writeStartElement(xmlTagArea);
writer.writeAttribute(xmlAttributeImage, i.key());
writer.writeAttribute(xmlAttributeX, QString::number(i.value().x()));

View File

@@ -133,17 +133,15 @@ void ScxmlDocument::addNamespace(ScxmlNamespace *ns)
ScxmlTag *scxmlTag = scxmlRootTag();
if (scxmlTag) {
QMapIterator<QString, ScxmlNamespace*> i(m_namespaces);
while (i.hasNext()) {
i.next();
QString prefix = i.value()->prefix();
for (ScxmlNamespace *ns : qAsConst(m_namespaces)) {
QString prefix = ns->prefix();
if (prefix.isEmpty())
prefix = "xmlns";
if (prefix.startsWith("xmlns"))
scxmlTag->setAttribute(prefix, i.value()->name());
scxmlTag->setAttribute(prefix, ns->name());
else
scxmlTag->setAttribute(QString::fromLatin1("xmlns:%1").arg(prefix), i.value()->name());
scxmlTag->setAttribute(QString::fromLatin1("xmlns:%1").arg(prefix), ns->name());
}
}
}
@@ -172,17 +170,15 @@ bool ScxmlDocument::generateSCXML(QIODevice *io, ScxmlTag *tag) const
ScxmlTag *ScxmlDocument::createScxmlTag()
{
auto tag = new ScxmlTag(Scxml, this);
QMapIterator<QString, ScxmlNamespace*> i(m_namespaces);
while (i.hasNext()) {
i.next();
QString prefix = i.value()->prefix();
for (ScxmlNamespace *ns : m_namespaces) {
QString prefix = ns->prefix();
if (prefix.isEmpty())
prefix = "xmlns";
if (prefix.startsWith("xmlns"))
tag->setAttribute(prefix, i.value()->name());
tag->setAttribute(prefix, ns->name());
else
tag->setAttribute(QString::fromLatin1("xmlns:%1").arg(prefix), i.value()->name());
tag->setAttribute(QString::fromLatin1("xmlns:%1").arg(prefix), ns->name());
}
return tag;
}

View File

@@ -552,11 +552,8 @@ void ScxmlTag::writeXml(QXmlStreamWriter &xml)
// Write editorinfo if necessary
if (!m_editorInfo.isEmpty()) {
xml.writeStartElement("qt:editorinfo");
QHashIterator<QString, QString> i(m_editorInfo);
while (i.hasNext()) {
i.next();
for (auto i = m_editorInfo.cbegin(), end = m_editorInfo.cend(); i != end; ++i)
xml.writeAttribute(i.key(), i.value());
}
xml.writeEndElement();
}

View File

@@ -496,10 +496,8 @@ QStringList BaseFileFind::replaceAll(const QString &text,
changes[QDir::fromNativeSeparators(item.path.first())].append(item);
// Checking for files without write permissions
QHashIterator<QString, QList<SearchResultItem> > it(changes);
QSet<FilePath> roFiles;
while (it.hasNext()) {
it.next();
for (auto it = changes.cbegin(), end = changes.cend(); it != end; ++it) {
const QFileInfo fileInfo(it.key());
if (!fileInfo.isWritable())
roFiles.insert(FilePath::fromString(it.key()));
@@ -513,9 +511,7 @@ QStringList BaseFileFind::replaceAll(const QString &text,
return QStringList();
}
it.toFront();
while (it.hasNext()) {
it.next();
for (auto it = changes.cbegin(), end = changes.cend(); it != end; ++it) {
const QString fileName = it.key();
const QList<SearchResultItem> changeItems = it.value();

View File

@@ -251,9 +251,8 @@ bool ColorScheme::save(const QString &fileName, QWidget *parent) const
if (!m_displayName.isEmpty())
w.writeAttribute(QLatin1String("name"), m_displayName);
QMapIterator<TextStyle, Format> i(m_formats);
while (i.hasNext()) {
const Format &format = i.next().value();
for (auto i = m_formats.cbegin(), end = m_formats.cend(); i != end; ++i) {
const Format &format = i.value();
w.writeStartElement(QLatin1String("style"));
w.writeAttribute(QLatin1String("name"), QString::fromLatin1(Constants::nameForStyle(i.key())));
if (format.foreground().isValid())

View File

@@ -473,7 +473,7 @@ void TextEditorSettings::unregisterCodeStyleFactory(Core::Id languageId)
d->m_languageToFactory.remove(languageId);
}
QMap<Core::Id, ICodeStylePreferencesFactory *> TextEditorSettings::codeStyleFactories()
const QMap<Core::Id, ICodeStylePreferencesFactory *> &TextEditorSettings::codeStyleFactories()
{
return d->m_languageToFactory;
}

View File

@@ -79,7 +79,7 @@ public:
static const CommentsSettings &commentsSettings();
static ICodeStylePreferencesFactory *codeStyleFactory(Core::Id languageId);
static QMap<Core::Id, ICodeStylePreferencesFactory *> codeStyleFactories();
static const QMap<Core::Id, ICodeStylePreferencesFactory *> &codeStyleFactories();
static void registerCodeStyleFactory(ICodeStylePreferencesFactory *codeStyleFactory);
static void unregisterCodeStyleFactory(Core::Id languageId);

View File

@@ -122,13 +122,11 @@ void TodoItemsProvider::createScanners()
void TodoItemsProvider::setItemsListWithinStartupProject()
{
QHashIterator<FilePath, QList<TodoItem> > it(m_itemsHash);
const auto filePaths = Utils::toSet(m_startupProject->files(Project::SourceFiles));
QVariantMap settings = m_startupProject->namedSettings(Constants::SETTINGS_NAME_KEY).toMap();
while (it.hasNext()) {
it.next();
for (auto it = m_itemsHash.cbegin(), end = m_itemsHash.cend(); it != end; ++it) {
const FilePath filePath = it.key();
if (filePaths.contains(filePath)) {
bool skip = false;
@@ -160,9 +158,7 @@ void TodoItemsProvider::setItemsListWithinSubproject()
// files must be both in the current subproject and the startup-project.
const auto fileNames = Utils::toSet(m_startupProject->files(Project::SourceFiles));
QHashIterator<FilePath, QList<TodoItem> > it(m_itemsHash);
while (it.hasNext()) {
it.next();
for (auto it = m_itemsHash.cbegin(), end = m_itemsHash.cend(); it != end; ++it) {
if (subprojectFileNames.contains(it.key()) && fileNames.contains(it.key()))
m_itemsList << it.value();
}

View File

@@ -239,9 +239,8 @@ JobRequests JobQueue::takeJobRequestsToRunNow()
using TranslationUnitIds = QSet<Utf8String>;
TranslationUnitIds translationUnitsScheduledForThisRun;
QMutableVectorIterator<JobRequest> i(m_queue);
while (i.hasNext()) {
const JobRequest &request = i.next();
for (int pos = 0; pos < m_queue.size(); ++pos) {
const JobRequest &request = m_queue.at(pos);
try {
const Document &document = m_documents.document(request.filePath);
@@ -258,7 +257,7 @@ JobRequests JobQueue::takeJobRequestsToRunNow()
translationUnitsScheduledForThisRun.insert(id);
jobsToRun += request;
i.remove();
m_queue.removeAt(pos--);
} catch (const std::exception &exception) {
qWarning() << "Error in Jobs::takeJobRequestsToRunNow for"
<< request << ":" << exception.what();