summaryrefslogtreecommitdiff
path: root/src/filetreemodel.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2020-07-20 19:02:14 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2020-07-20 19:02:14 -0400
commit0c7265be4f897834fc6126068c1423b6d2defdaf (patch)
treeec47317c05edb84dc1dbe19ede389d4f9253b687 /src/filetreemodel.cpp
parent6c4e237d4b43db5c3f9dc01f8c0d3313f3bd2605 (diff)
only sort once at the end when fully loading for search
temporarily disable filtering completely when fully loading instead of just disabling recursive filtering, this could close already expanded nodes if their parent directories didn't match
Diffstat (limited to 'src/filetreemodel.cpp')
-rw-r--r--src/filetreemodel.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/filetreemodel.cpp b/src/filetreemodel.cpp
index 8790f981..59025479 100644
--- a/src/filetreemodel.cpp
+++ b/src/filetreemodel.cpp
@@ -227,7 +227,7 @@ void FileTreeModel::clear()
void FileTreeModel::recursiveFetchMore(const QModelIndex& m)
{
if (canFetchMore(m)) {
- doFetchMore(m, false);
+ doFetchMore(m, false, false);
}
for (int i=0; i<rowCount(m); ++i) {
@@ -240,6 +240,7 @@ void FileTreeModel::ensureFullyLoaded()
if (!m_fullyLoaded) {
TimeThis tt("FileTreeModel:: fully loading for search");
recursiveFetchMore(QModelIndex());
+ sortItem(*m_root, false);
m_fullyLoaded = true;
}
}
@@ -350,10 +351,11 @@ bool FileTreeModel::canFetchMore(const QModelIndex& parent) const
void FileTreeModel::fetchMore(const QModelIndex& parent)
{
- doFetchMore(parent, true);
+ doFetchMore(parent, true, true);
}
-void FileTreeModel::doFetchMore(const QModelIndex& parent, bool forFetch)
+void FileTreeModel::doFetchMore(
+ const QModelIndex& parent, bool forFetch, bool doSort)
{
FileTreeItem* item = itemFromIndex(parent);
if (!item) {
@@ -373,7 +375,7 @@ void FileTreeModel::doFetchMore(const QModelIndex& parent, bool forFetch)
const auto parentPath = item->dataRelativeParentPath();
update(*item, *parentEntry, parentPath.toStdWString(), forFetch);
- if (!forFetch) {
+ if (!forFetch && doSort) {
sortItem(*item, false);
}
}