diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 4a7cdd3d137..b7ecb8b0b8e 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -3180,17 +3180,14 @@ void EditorManager::openEditorAtSearchResult(const SearchResultItem &item, OpenEditorFlags flags, bool *newEditor) { - if (item.path().empty()) { + const QStringList &path = item.path(); + if (path.isEmpty()) { openEditor(FilePath::fromUserInput(item.lineText()), editorId, flags, newEditor); return; } - - openEditorAt({FilePath::fromUserInput(item.path().first()), - item.mainRange().begin.line, - item.mainRange().begin.column}, - editorId, - flags, - newEditor); + const Search::TextPosition position = item.mainRange().begin; + openEditorAt({FilePath::fromUserInput(path.first()), position.line, position.column}, + editorId, flags, newEditor); } /*! diff --git a/src/plugins/git/gitgrep.cpp b/src/plugins/git/gitgrep.cpp index 243952c2d41..dc74c7bc430 100644 --- a/src/plugins/git/gitgrep.cpp +++ b/src/plugins/git/gitgrep.cpp @@ -281,13 +281,14 @@ QFuture GitGrep::executeSearch(const TextEditor::FileFindP IEditor *GitGrep::openEditor(const SearchResultItem &item, const TextEditor::FileFindParameters ¶meters) { - GitGrepParameters params = parameters.searchEngineParameters.value(); - if (params.ref.isEmpty() || item.path().isEmpty()) + const GitGrepParameters params = parameters.searchEngineParameters.value(); + const QStringList &itemPath = item.path(); + if (params.ref.isEmpty() || itemPath.isEmpty()) return nullptr; - const QString path = QDir::fromNativeSeparators(item.path().first()); + const QString path = QDir::fromNativeSeparators(itemPath.first()); const FilePath topLevel = FilePath::fromString(parameters.additionalParameters.toString()); - IEditor *editor = m_client->openShowEditor( - topLevel, params.ref, path, GitClient::ShowEditor::OnlyIfDifferent); + IEditor *editor = m_client->openShowEditor(topLevel, params.ref, path, + GitClient::ShowEditor::OnlyIfDifferent); if (editor) editor->gotoLine(item.mainRange().begin.line, item.mainRange().begin.column); return editor; diff --git a/src/plugins/python/pythonlanguageclient.cpp b/src/plugins/python/pythonlanguageclient.cpp index ce8d254ba74..f4b6a0d52fc 100644 --- a/src/plugins/python/pythonlanguageclient.cpp +++ b/src/plugins/python/pythonlanguageclient.cpp @@ -268,7 +268,7 @@ void PyLSClient::updateExtraCompilerContents(ExtraCompiler *compiler, const File void PyLSClient::closeExtraCompiler(ProjectExplorer::ExtraCompiler *compiler) { - const FilePath file = compiler->targets().first(); + const FilePath file = compiler->targets().constFirst(); m_extraCompilerOutputDir.pathAppended(file.fileName()).removeFile(); compiler->disconnect(this); } diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index 12c635a119e..627119048fb 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -484,7 +484,7 @@ FilePaths BaseFileFind::replaceAll(const QString &text, QHash > changes; for (const SearchResultItem &item : items) - changes[FilePath::fromUserInput(item.path().first())].append(item); + changes[FilePath::fromUserInput(item.path().constFirst())].append(item); // Checking for files without write permissions QSet roFiles; diff --git a/src/plugins/texteditor/snippets/snippetoverlay.cpp b/src/plugins/texteditor/snippets/snippetoverlay.cpp index 6824c0470ac..05a2391ae61 100644 --- a/src/plugins/texteditor/snippets/snippetoverlay.cpp +++ b/src/plugins/texteditor/snippets/snippetoverlay.cpp @@ -102,7 +102,7 @@ QTextCursor SnippetOverlay::nextSelectionCursor(const QTextCursor &cursor) const if (selections[selectionIndex].m_cursor_begin.position() > cursor.position()) return cursorForIndex(selectionIndex); } - return cursorForIndex(m_variables[nextVariableIndex].first()); + return cursorForIndex(m_variables[nextVariableIndex].constFirst()); } // currently not over a variable simply select the next available one for (const OverlaySelection &candidate : selections) { @@ -128,7 +128,7 @@ QTextCursor SnippetOverlay::previousSelectionCursor(const QTextCursor &cursor) c if (selections.at(equivalents.at(i)).m_cursor_end.position() < cursor.position()) return cursorForIndex(equivalents.at(i)); } - return cursorForIndex(m_variables[previousVariableIndex].last()); + return cursorForIndex(m_variables[previousVariableIndex].constLast()); } // currently not over a variable simply select the previous available one for (int i = selections.size() - 1; i >= 0; --i) {