diff options
author | Eike Ziller <eike.ziller@qt.io> | 2021-10-21 11:36:27 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2021-10-26 09:29:35 +0000 |
commit | 74454a3531aa772d083b2d61e2d1e6e1184146d6 (patch) | |
tree | 2d4eb3a01531fde7fcf8ab23e8839182e7911d05 | |
parent | 665285b981e5bb12dcce246262e4cb857eac4139 (diff) |
Open project folder in File System view
If no editor is open and syncing of the root is on (the default):
- make "Projects" or the last opened project the default root
- switch to project root when project is opened
If an editor is open, everything stays as is.
Fixes: QTCREATORBUG-23632
Change-Id: Ie409e2ef676fe933cb4b7f32f2347fea19e5927e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | src/plugins/projectexplorer/foldernavigationwidget.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/projectexplorer/foldernavigationwidget.cpp b/src/plugins/projectexplorer/foldernavigationwidget.cpp index 988d77eba5..3a04ad8a1c 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.cpp +++ b/src/plugins/projectexplorer/foldernavigationwidget.cpp @@ -486,8 +486,13 @@ void FolderNavigationWidget::insertRootDirectory( m_rootSelector->setCurrentIndex(index); if (previousIndex < m_rootSelector->count()) m_rootSelector->removeItem(previousIndex); - if (m_autoSync) // we might find a better root for current selection now - handleCurrentEditorChanged(Core::EditorManager::currentEditor()); + if (Core::EditorManager::currentEditor()) { + if (m_autoSync) // we might find a better root for current selection now + handleCurrentEditorChanged(Core::EditorManager::currentEditor()); + } else if (m_rootAutoSync) { + // assume the new root is better (e.g. because a project was opened) + m_rootSelector->setCurrentIndex(index); + } } void FolderNavigationWidget::removeRootDirectory(const QString &id) |