summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Sokolovskii <artem.sokolovskii@qt.io>2022-05-17 10:31:15 +0200
committerArtem Sokolovskii <artem.sokolovskii@qt.io>2022-05-19 07:33:27 +0000
commit66f132dd9b0e78168e48929eda976e7ebbb810c4 (patch)
tree362668a7ab193a2dec8e5add56b7e40c46b0d3fa
parenta2797ec80e8024fb40b314f6ed9f280c19fbc0a6 (diff)
downloadqt-creator-66f132dd9b0e78168e48929eda976e7ebbb810c4.tar.gz
TextEditor: Remove foreach / Q_FOREACH usage
Task-number: QTCREATORBUG-27464 Change-Id: Ie9594bf661dbeecf22589c1580648252f0bfb7fb Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io>
-rw-r--r--src/plugins/texteditor/behaviorsettingswidget.cpp5
-rw-r--r--src/plugins/texteditor/codeassist/genericproposal.cpp2
-rw-r--r--src/plugins/texteditor/colorschemeedit.cpp9
-rw-r--r--src/plugins/texteditor/findinfiles.cpp5
-rw-r--r--src/plugins/texteditor/findinopenfiles.cpp4
-rw-r--r--src/plugins/texteditor/fontsettings.cpp2
-rw-r--r--src/plugins/texteditor/fontsettingspage.cpp5
-rw-r--r--src/plugins/texteditor/outlinefactory.cpp9
-rw-r--r--src/plugins/texteditor/refactoringchanges.cpp2
-rw-r--r--src/plugins/texteditor/tabsettings.cpp2
-rw-r--r--src/plugins/texteditor/textdocument.cpp10
-rw-r--r--src/plugins/texteditor/texteditor.cpp41
-rw-r--r--src/plugins/texteditor/texteditoractionhandler.cpp2
-rw-r--r--src/plugins/texteditor/textmark.cpp12
14 files changed, 65 insertions, 45 deletions
diff --git a/src/plugins/texteditor/behaviorsettingswidget.cpp b/src/plugins/texteditor/behaviorsettingswidget.cpp
index 510796afab..4a4eae51c2 100644
--- a/src/plugins/texteditor/behaviorsettingswidget.cpp
+++ b/src/plugins/texteditor/behaviorsettingswidget.cpp
@@ -65,10 +65,11 @@ BehaviorSettingsWidget::BehaviorSettingsWidget(QWidget *parent)
std::find_if(mibs.begin(), mibs.end(), [](int n) { return n >=0; });
if (firstNonNegative != mibs.end())
std::rotate(mibs.begin(), firstNonNegative, mibs.end());
- foreach (int mib, mibs) {
+ for (int mib : qAsConst(mibs)) {
if (QTextCodec *codec = QTextCodec::codecForMib(mib)) {
QString compoundName = QLatin1String(codec->name());
- foreach (const QByteArray &alias, codec->aliases()) {
+ const QList<QByteArray> aliases = codec->aliases();
+ for (const QByteArray &alias : aliases) {
compoundName += QLatin1String(" / ");
compoundName += QString::fromLatin1(alias);
}
diff --git a/src/plugins/texteditor/codeassist/genericproposal.cpp b/src/plugins/texteditor/codeassist/genericproposal.cpp
index 4b2e0415ab..2bc66db2e6 100644
--- a/src/plugins/texteditor/codeassist/genericproposal.cpp
+++ b/src/plugins/texteditor/codeassist/genericproposal.cpp
@@ -53,7 +53,7 @@ GenericProposal *GenericProposal::createProposal(const AssistInterface *interfac
return nullptr;
QList<AssistProposalItemInterface *> items;
- foreach (const QuickFixOperation::Ptr &op, quickFixes) {
+ for (const QuickFixOperation::Ptr &op : quickFixes) {
QVariant v;
v.setValue(op);
auto item = new AssistProposalItem;
diff --git a/src/plugins/texteditor/colorschemeedit.cpp b/src/plugins/texteditor/colorschemeedit.cpp
index ec316880bd..72bfbe4a9f 100644
--- a/src/plugins/texteditor/colorschemeedit.cpp
+++ b/src/plugins/texteditor/colorschemeedit.cpp
@@ -456,7 +456,8 @@ void ColorSchemeEdit::eraseBackColor()
m_ui->backgroundToolButton->setStyleSheet(colorButtonStyleSheet(newColor));
m_ui->eraseBackgroundToolButton->setEnabled(false);
- foreach (const QModelIndex &index, m_ui->itemList->selectionModel()->selectedRows()) {
+ const QList<QModelIndex> indexes = m_ui->itemList->selectionModel()->selectedRows();
+ for (const QModelIndex &index : indexes) {
const TextStyle category = m_descriptions[index.row()].id();
m_scheme.formatFor(category).setBackground(newColor);
m_formatsModel->emitDataChanged(index);
@@ -473,7 +474,8 @@ void ColorSchemeEdit::eraseForeColor()
m_ui->foregroundToolButton->setStyleSheet(colorButtonStyleSheet(newColor));
m_ui->eraseForegroundToolButton->setEnabled(false);
- for (const QModelIndex &index : m_ui->itemList->selectionModel()->selectedRows()) {
+ const QList<QModelIndex> indexes = m_ui->itemList->selectionModel()->selectedRows();
+ for (const QModelIndex &index : indexes) {
const TextStyle category = m_descriptions[index.row()].id();
m_scheme.formatFor(category).setForeground(newColor);
m_formatsModel->emitDataChanged(index);
@@ -538,7 +540,8 @@ void ColorSchemeEdit::eraseRelativeBackColor()
m_ui->backgroundSaturationSpinBox->setValue(0.0);
m_ui->backgroundLightnessSpinBox->setValue(0.0);
- foreach (const QModelIndex &index, m_ui->itemList->selectionModel()->selectedRows()) {
+ const QList<QModelIndex> indexes = m_ui->itemList->selectionModel()->selectedRows();
+ for (const QModelIndex &index : indexes) {
const TextStyle category = m_descriptions[index.row()].id();
m_scheme.formatFor(category).setRelativeBackgroundSaturation(0.0);
m_scheme.formatFor(category).setRelativeBackgroundLightness(0.0);
diff --git a/src/plugins/texteditor/findinfiles.cpp b/src/plugins/texteditor/findinfiles.cpp
index 9b0a3b4c70..7f135af611 100644
--- a/src/plugins/texteditor/findinfiles.cpp
+++ b/src/plugins/texteditor/findinfiles.cpp
@@ -159,7 +159,8 @@ QWidget *FindInFiles::createConfigWidget()
gridLayout->addWidget(m_searchEngineCombo, row, 1);
m_searchEngineWidget = new QStackedWidget(m_configWidget);
- foreach (SearchEngine *searchEngine, searchEngines()) {
+ const QVector<SearchEngine *> searchEngineVector = searchEngines();
+ for (const SearchEngine *searchEngine : searchEngineVector) {
m_searchEngineWidget->addWidget(searchEngine->widget());
m_searchEngineCombo->addItem(searchEngine->title());
}
@@ -197,7 +198,7 @@ QWidget *FindInFiles::createConfigWidget()
setValid(currentSearchEngine()->isEnabled() && m_directory->isValid());
};
connect(this, &BaseFileFind::currentSearchEngineChanged, this, updateValidity);
- foreach (SearchEngine *searchEngine, searchEngines())
+ for (const SearchEngine *searchEngine : searchEngineVector)
connect(searchEngine, &SearchEngine::enabledChanged, this, updateValidity);
connect(m_directory.data(), &PathChooser::validChanged, this, updateValidity);
updateValidity();
diff --git a/src/plugins/texteditor/findinopenfiles.cpp b/src/plugins/texteditor/findinopenfiles.cpp
index 80f0e13097..4f10a43079 100644
--- a/src/plugins/texteditor/findinopenfiles.cpp
+++ b/src/plugins/texteditor/findinopenfiles.cpp
@@ -66,8 +66,8 @@ Utils::FileIterator *FindInOpenFiles::files(const QStringList &nameFilters,
= TextDocument::openedTextDocumentEncodings();
QStringList fileNames;
QList<QTextCodec *> codecs;
- foreach (Core::DocumentModel::Entry *entry,
- Core::DocumentModel::entries()) {
+ const QList<Core::DocumentModel::Entry *> entries = Core::DocumentModel::entries();
+ for (Core::DocumentModel::Entry *entry : entries) {
QString fileName = entry->fileName().toString();
if (!fileName.isEmpty()) {
fileNames.append(fileName);
diff --git a/src/plugins/texteditor/fontsettings.cpp b/src/plugins/texteditor/fontsettings.cpp
index ef8a36af94..b3265dcbd2 100644
--- a/src/plugins/texteditor/fontsettings.cpp
+++ b/src/plugins/texteditor/fontsettings.cpp
@@ -414,7 +414,7 @@ bool FontSettings::loadColorScheme(const QString &fileName,
}
// Apply default formats to undefined categories
- foreach (const FormatDescription &desc, descriptions) {
+ for (const FormatDescription &desc : descriptions) {
const TextStyle id = desc.id();
if (!m_scheme.contains(id)) {
if (id == C_NAMESPACE && m_scheme.contains(C_TYPE)) {
diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp
index f3ac7597a4..99183ace52 100644
--- a/src/plugins/texteditor/fontsettingspage.cpp
+++ b/src/plugins/texteditor/fontsettingspage.cpp
@@ -626,7 +626,7 @@ void FontSettingsPageWidget::refreshColorSchemeList()
QString defaultScheme = Utils::FilePath::fromString(FontSettings::defaultSchemeFileName()).fileName();
if (schemeList.removeAll(defaultScheme))
schemeList.prepend(defaultScheme);
- foreach (const QString &file, schemeList) {
+ for (const QString &file : qAsConst(schemeList)) {
const QString fileName = styleDir.absoluteFilePath(file);
if (m_value.colorSchemeFileName() == fileName)
selected = colorSchemes.size();
@@ -638,7 +638,8 @@ void FontSettingsPageWidget::refreshColorSchemeList()
styleDir.setPath(customStylesPath().path());
- foreach (const QString &file, styleDir.entryList()) {
+ const QStringList files = styleDir.entryList();
+ for (const QString &file : files) {
const QString fileName = styleDir.absoluteFilePath(file);
if (m_value.colorSchemeFileName() == fileName)
selected = colorSchemes.size();
diff --git a/src/plugins/texteditor/outlinefactory.cpp b/src/plugins/texteditor/outlinefactory.cpp
index 6590ccdce1..2b04c20c10 100644
--- a/src/plugins/texteditor/outlinefactory.cpp
+++ b/src/plugins/texteditor/outlinefactory.cpp
@@ -129,7 +129,8 @@ void OutlineWidgetStack::restoreSettings(QSettings *settings, int position)
bool syncWithEditor = true;
m_widgetSettings.clear();
- foreach (const QString &longKey, settings->allKeys()) {
+ const QStringList longKeys = settings->allKeys();
+ for (const QString &longKey : longKeys) {
if (!longKey.startsWith(baseKey))
continue;
@@ -169,10 +170,10 @@ void OutlineWidgetStack::toggleSort()
void OutlineWidgetStack::updateFilterMenu()
{
m_filterMenu->clear();
- if (auto outlineWidget = qobject_cast<IOutlineWidget*>(currentWidget())) {
- foreach (QAction *filterAction, outlineWidget->filterMenuActions()) {
+ if (auto outlineWidget = qobject_cast<IOutlineWidget *>(currentWidget())) {
+ const QList<QAction *> filterActions = outlineWidget->filterMenuActions();
+ for (QAction *filterAction : filterActions)
m_filterMenu->addAction(filterAction);
- }
}
m_filterButton->setVisible(!m_filterMenu->actions().isEmpty());
}
diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp
index 878c48b4b3..77f168661f 100644
--- a/src/plugins/texteditor/refactoringchanges.cpp
+++ b/src/plugins/texteditor/refactoringchanges.cpp
@@ -59,7 +59,7 @@ RefactoringSelections RefactoringChanges::rangesToSelections(QTextDocument *docu
{
RefactoringSelections selections;
- foreach (const Range &range, ranges) {
+ for (const Range &range : ranges) {
QTextCursor start(document);
start.setPosition(range.start);
start.setKeepPositionOnInsert(true);
diff --git a/src/plugins/texteditor/tabsettings.cpp b/src/plugins/texteditor/tabsettings.cpp
index a51138d0cd..b9ef8ab22e 100644
--- a/src/plugins/texteditor/tabsettings.cpp
+++ b/src/plugins/texteditor/tabsettings.cpp
@@ -273,7 +273,7 @@ bool TabSettings::guessSpacesForTabs(const QTextBlock &_block) const
if (currentBlocks.at(1).isValid())
currentBlocks[1] = currentBlocks.at(1).next();
bool done = true;
- foreach (const QTextBlock &block, currentBlocks) {
+ for (const QTextBlock &block : qAsConst(currentBlocks)) {
if (block.isValid())
done = false;
if (!block.isValid() || block.length() == 0)
diff --git a/src/plugins/texteditor/textdocument.cpp b/src/plugins/texteditor/textdocument.cpp
index 2c4a95d99e..195a48f62c 100644
--- a/src/plugins/texteditor/textdocument.cpp
+++ b/src/plugins/texteditor/textdocument.cpp
@@ -260,7 +260,8 @@ TextDocument::~TextDocument()
QMap<QString, QString> TextDocument::openedTextDocumentContents()
{
QMap<QString, QString> workingCopy;
- foreach (IDocument *document, DocumentModel::openedDocuments()) {
+ const QList<IDocument *> documents = DocumentModel::openedDocuments();
+ for (IDocument *document : documents) {
auto textEditorDocument = qobject_cast<TextDocument *>(document);
if (!textEditorDocument)
continue;
@@ -273,7 +274,8 @@ QMap<QString, QString> TextDocument::openedTextDocumentContents()
QMap<QString, QTextCodec *> TextDocument::openedTextDocumentEncodings()
{
QMap<QString, QTextCodec *> workingCopy;
- foreach (IDocument *document, DocumentModel::openedDocuments()) {
+ const QList<IDocument *> documents = DocumentModel::openedDocuments();
+ for (IDocument *document : documents) {
auto textEditorDocument = qobject_cast<TextDocument *>(document);
if (!textEditorDocument)
continue;
@@ -912,7 +914,7 @@ void TextDocument::cleanWhitespace(QTextCursor &cursor, bool inEntireDocument,
const IndentationForBlock &indentations
= d->m_indenter->indentationForBlocks(blocks, currentTabSettings);
- foreach (block, blocks) {
+ for (QTextBlock block : qAsConst(blocks)) {
QString blockText = block.text();
if (removeTrailingWhitespace)
@@ -1050,7 +1052,7 @@ void TextDocument::removeMarkFromMarksCache(TextMark *mark)
documentLayout->requestExtraAreaUpdate();
} else {
double maxWidthFactor = 1.0;
- foreach (const TextMark *mark, marks()) {
+ for (const TextMark *mark : qAsConst(d->m_marksCache)) {
if (!mark->isVisible())
continue;
maxWidthFactor = qMax(mark->widthFactor(), maxWidthFactor);
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp
index d2eb9e43e3..0fdb90137c 100644
--- a/src/plugins/texteditor/texteditor.cpp
+++ b/src/plugins/texteditor/texteditor.cpp
@@ -625,7 +625,7 @@ public:
int start;
int length;
};
- void addSearchResultsToScrollBar(QVector<SearchResult> results);
+ void addSearchResultsToScrollBar(const QVector<SearchResult> &results);
void adjustScrollBarRanges();
void setFindScope(const MultiTextCursor &scope);
@@ -2229,7 +2229,8 @@ void TextEditorWidgetPrivate::moveLineUpDown(bool up)
RefactorMarkers nonAffectedMarkers;
QList<int> markerOffsets;
- foreach (const RefactorMarker &marker, m_refactorOverlay->markers()) {
+ const QList<RefactorMarker> markers = m_refactorOverlay->markers();
+ for (const RefactorMarker &marker : markers) {
//test if marker is part of the selection to be moved
if ((move.selectionStart() <= marker.cursor.position())
&& (move.selectionEnd() >= marker.cursor.position())) {
@@ -2674,7 +2675,7 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *e)
QChar electricChar;
if (d->m_document->typingSettings().m_autoIndent) {
- foreach (QChar c, eventText) {
+ for (const QChar c : eventText) {
if (d->m_document->indenter()->isElectricCharacter(c)) {
electricChar = c;
break;
@@ -3100,7 +3101,7 @@ void TextEditorWidget::restoreState(const QByteArray &state)
stream >> collapsedBlocks;
QTextDocument *doc = document();
bool layoutChanged = false;
- foreach (int blockNumber, collapsedBlocks) {
+ for (const int blockNumber : qAsConst(collapsedBlocks)) {
QTextBlock block = doc->findBlockByNumber(qMax(0, blockNumber));
if (block.isValid()) {
TextDocumentLayout::doFoldOrUnfold(block, false);
@@ -4105,10 +4106,12 @@ void TextEditorWidgetPrivate::paintBlockHighlight(const PaintEventData &data,
int n = block.blockNumber();
int depth = 0;
- foreach (int i, m_highlightBlocksInfo.open)
+ const QList<int> open = m_highlightBlocksInfo.open;
+ for (const int i : open)
if (n >= i)
++depth;
- foreach (int i, m_highlightBlocksInfo.close)
+ const QList<int> close = m_highlightBlocksInfo.close;
+ for (const int i : close)
if (n > i)
--depth;
@@ -5567,7 +5570,8 @@ static void appendMenuActionsFromContext(QMenu *menu, Id menuContextId)
ActionContainer *mcontext = ActionManager::actionContainer(menuContextId);
QMenu *contextMenu = mcontext->menu();
- foreach (QAction *action, contextMenu->actions())
+ const QList<QAction *> actions = contextMenu->actions();
+ for (QAction *action : actions)
menu->addAction(action);
}
@@ -6213,7 +6217,8 @@ void TextEditorWidgetPrivate::searchResultsReady(int beginIndex, int endIndex)
{
QVector<SearchResult> results;
for (int index = beginIndex; index < endIndex; ++index) {
- foreach (Utils::FileSearchResult result, m_searchWatcher->resultAt(index)) {
+ const QList<Utils::FileSearchResult> resultList = m_searchWatcher->resultAt(index);
+ for (Utils::FileSearchResult result : resultList) {
const QTextBlock &block = q->document()->findBlockByNumber(result.lineNumber - 1);
const int matchStart = block.position() + result.matchStart;
QTextCursor cursor(block);
@@ -6312,11 +6317,11 @@ Highlight::Priority textMarkPrioToScrollBarPrio(const TextMark::Priority &prio)
}
}
-void TextEditorWidgetPrivate::addSearchResultsToScrollBar(QVector<SearchResult> results)
+void TextEditorWidgetPrivate::addSearchResultsToScrollBar(const QVector<SearchResult> &results)
{
if (!m_highlightScrollBarController)
return;
- foreach (SearchResult result, results) {
+ for (SearchResult result : results) {
const QTextBlock &block = q->document()->findBlock(result.start);
if (block.isValid() && block.isVisible()) {
const int firstLine = block.layout()->lineForTextPosition(result.start - block.position()).lineNumber();
@@ -6558,7 +6563,9 @@ void TextEditorWidgetPrivate::_q_matchParentheses()
if (animatePosition >= 0) {
- foreach (const QTextEdit::ExtraSelection &sel, q->extraSelections(TextEditorWidget::ParenthesesMatchingSelection)) {
+ const QList<QTextEdit::ExtraSelection> selections = q->extraSelections(
+ TextEditorWidget::ParenthesesMatchingSelection);
+ for (const QTextEdit::ExtraSelection &sel : selections) {
if (sel.cursor.selectionStart() == animatePosition
|| sel.cursor.selectionEnd() - 1 == animatePosition) {
animatePosition = -1;
@@ -6904,7 +6911,7 @@ void TextEditorWidgetPrivate::setExtraSelections(Id kind, const QList<QTextEdit:
if (kind == TextEditorWidget::CodeSemanticsSelection) {
m_overlay->clear();
- foreach (const QTextEdit::ExtraSelection &selection, m_extraSelections[kind]) {
+ for (const QTextEdit::ExtraSelection &selection : selections) {
m_overlay->addOverlaySelection(selection.cursor,
selection.format.background().color(),
selection.format.background().color(),
@@ -6935,7 +6942,7 @@ QList<QTextEdit::ExtraSelection> TextEditorWidget::extraSelections(Id kind) cons
QString TextEditorWidget::extraSelectionTooltip(int pos) const
{
- foreach (const QList<QTextEdit::ExtraSelection> &sel, d->m_extraSelections) {
+ for (const QList<QTextEdit::ExtraSelection> &sel : qAsConst(d->m_extraSelections)) {
for (const QTextEdit::ExtraSelection &s : sel) {
if (s.cursor.selectionStart() <= pos
&& s.cursor.selectionEnd() >= pos
@@ -7434,7 +7441,8 @@ QMimeData *TextEditorWidget::createMimeDataFromSelection() const
current = current.next()) {
if (selectionVisible(current.blockNumber())) {
const QTextLayout *layout = current.layout();
- foreach (const QTextLayout::FormatRange &range, layout->formats()) {
+ const QVector<QTextLayout::FormatRange> ranges = layout->formats();
+ for (const QTextLayout::FormatRange &range : ranges) {
const int startPosition = current.position() + range.start
- selectionStart - removedCount;
const int endPosition = startPosition + range.length;
@@ -7974,10 +7982,11 @@ RefactorMarkers TextEditorWidget::refactorMarkers() const
void TextEditorWidget::setRefactorMarkers(const RefactorMarkers &markers)
{
- foreach (const RefactorMarker &marker, d->m_refactorOverlay->markers())
+ const QList<RefactorMarker> oldMarkers = d->m_refactorOverlay->markers();
+ for (const RefactorMarker &marker : oldMarkers)
emit requestBlockUpdate(marker.cursor.block());
d->m_refactorOverlay->setMarkers(markers);
- foreach (const RefactorMarker &marker, markers)
+ for (const RefactorMarker &marker : markers)
emit requestBlockUpdate(marker.cursor.block());
}
diff --git a/src/plugins/texteditor/texteditoractionhandler.cpp b/src/plugins/texteditor/texteditoractionhandler.cpp
index ff19f96078..df0cca7a8e 100644
--- a/src/plugins/texteditor/texteditoractionhandler.cpp
+++ b/src/plugins/texteditor/texteditoractionhandler.cpp
@@ -457,7 +457,7 @@ void TextEditorActionHandlerPrivate::createActions()
void TextEditorActionHandlerPrivate::updateActions()
{
bool isWritable = m_currentEditorWidget && !m_currentEditorWidget->isReadOnly();
- foreach (QAction *a, m_modifyingActions)
+ for (QAction *a : qAsConst(m_modifyingActions))
a->setEnabled(isWritable);
m_unCommentSelectionAction->setEnabled((m_optionalActions & TextEditorActionHandler::UnCommentSelection) && isWritable);
m_visualizeWhitespaceAction->setEnabled(m_currentEditorWidget);
diff --git a/src/plugins/texteditor/textmark.cpp b/src/plugins/texteditor/textmark.cpp
index 2f839d9413..447749fb1f 100644
--- a/src/plugins/texteditor/textmark.cpp
+++ b/src/plugins/texteditor/textmark.cpp
@@ -472,7 +472,8 @@ void TextMarkRegistry::editorOpened(IEditor *editor)
if (!m_marks.contains(document->filePath()))
return;
- foreach (TextMark *mark, m_marks.value(document->filePath()))
+ const QSet<TextMark *> marks = m_marks.value(document->filePath());
+ for (TextMark *mark : marks)
document->addMark(mark);
}
@@ -487,13 +488,14 @@ void TextMarkRegistry::documentRenamed(IDocument *document,
return;
QSet<TextMark *> toBeMoved;
- foreach (TextMark *mark, baseTextDocument->marks())
+ const QList<TextMark *> marks = baseTextDocument->marks();
+ for (TextMark *mark : marks)
toBeMoved.insert(mark);
m_marks[oldPath].subtract(toBeMoved);
m_marks[newPath].unite(toBeMoved);
- foreach (TextMark *mark, toBeMoved)
+ for (TextMark *mark : qAsConst(toBeMoved))
mark->updateFileName(newPath);
}
@@ -502,12 +504,12 @@ void TextMarkRegistry::allDocumentsRenamed(const FilePath &oldPath, const FilePa
if (!m_marks.contains(oldPath))
return;
- QSet<TextMark *> oldFileNameMarks = m_marks.value(oldPath);
+ const QSet<TextMark *> oldFileNameMarks = m_marks.value(oldPath);
m_marks[newPath].unite(oldFileNameMarks);
m_marks[oldPath].clear();
- foreach (TextMark *mark, oldFileNameMarks)
+ for (TextMark *mark : oldFileNameMarks)
mark->updateFileName(newPath);
}