ProjectExplorer: Use already-open visible editor, if available

... when following links from the issues pane.

Fixes: QTCREATORBUG-13961
Change-Id: I799e34f8fa789ef824b3b4aa2a075c938d6f1271
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Christian Kandeler
2021-01-25 17:27:20 +01:00
parent 7a6aa75032
commit 2604a8e485
2 changed files with 6 additions and 3 deletions

View File

@@ -46,7 +46,8 @@ bool ShowInEditorTaskHandler::canHandle(const Task &task) const
void ShowInEditorTaskHandler::handle(const Task &task)
{
QFileInfo fi(task.file.toFileInfo());
Core::EditorManager::openEditorAt(fi.filePath(), task.movedLine);
Core::EditorManager::openEditorAt(fi.filePath(), task.movedLine, {}, {},
Core::EditorManager::SwitchSplitIfAlreadyVisible);
}
QAction *ShowInEditorTaskHandler::createAction(QObject *parent) const

View File

@@ -237,8 +237,10 @@ void TaskView::mouseReleaseEvent(QMouseEvent *e)
{
if (m_linksActive && m_mouseButtonPressed == Qt::LeftButton) {
const Location loc = locationForPos(e->pos());
if (!loc.file.isEmpty())
Core::EditorManager::openEditorAt(loc.file.toString(), loc.line, loc.column);
if (!loc.file.isEmpty()) {
Core::EditorManager::openEditorAt(loc.file.toString(), loc.line, loc.column, {},
Core::EditorManager::SwitchSplitIfAlreadyVisible);
}
}
// Mouse was released, activate links again