correctly map root folder to source model

This commit is contained in:
itsmattkc
2021-03-31 11:55:00 +11:00
parent ce80fccd80
commit 62ff7bed69
5 changed files with 16 additions and 11 deletions
@@ -511,9 +511,15 @@ void ProjectExplorer::set_project(Project *p)
model_.set_project(p);
}
QModelIndex ProjectExplorer::get_root_index() const
Folder *ProjectExplorer::get_root() const
{
return tree_view_->rootIndex();
QModelIndex root_index = sort_model_.mapToSource(tree_view_->rootIndex());
if (!root_index.isValid()) {
return project()->root();
}
return static_cast<Folder *>(root_index.internalPointer());
}
void ProjectExplorer::set_root(Folder *item)