Fix project tree's "synchronize with editor"

When for example closing all editors, the selection in the project tree
is removed, but after re-opening the previously selected file, the
selection was still missing.

Qt item views differentiate between "current" item and "selection". The
code uses the "current" item for tracking, but when clearing the
selection in the project tree, the code did not "clear" the "current"
item.

Change-Id: I182c7b78bf8dcc51af71e860ac620310d472b7b5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Eike Ziller
2021-01-12 10:55:28 +01:00
parent 4231a88b67
commit b83c829e21

View File

@@ -512,6 +512,7 @@ void ProjectTreeWidget::setCurrentItem(Node *node)
} }
} else { } else {
m_view->clearSelection(); m_view->clearSelection();
m_view->setCurrentIndex({});
} }
} }