summaryrefslogtreecommitdiff
path: root/src/filetreemodel.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2020-02-08 21:38:01 -0500
committerisanae <14251494+isanae@users.noreply.github.com>2020-02-08 21:38:01 -0500
commit3a80685189967fbf4cfa002ac2b8a4fa421306ca (patch)
tree01d38125329508f5628f9221f797e303180c8fc3 /src/filetreemodel.cpp
parentd0c16e60d734fe2f72c387552559bf125554fb2d (diff)
don't sort items when they're not expanded
Diffstat (limited to 'src/filetreemodel.cpp')
-rw-r--r--src/filetreemodel.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/filetreemodel.cpp b/src/filetreemodel.cpp
index 40cded09..2130bf89 100644
--- a/src/filetreemodel.cpp
+++ b/src/filetreemodel.cpp
@@ -379,7 +379,7 @@ Qt::ItemFlags FileTreeModel::flags(const QModelIndex& index) const
return f;
}
-void FileTreeModel::sortItem(FileTreeItem& item)
+void FileTreeModel::sortItem(FileTreeItem& item, bool force)
{
emit layoutAboutToBeChanged();
@@ -394,7 +394,7 @@ void FileTreeModel::sortItem(FileTreeItem& item)
oldItems.push_back({itemFromIndex(index), index.column()});
}
- item.sort(m_sort.column, m_sort.order);
+ item.sort(m_sort.column, m_sort.order, force);
QModelIndexList newList;
newList.reserve(itemCount);
@@ -414,7 +414,7 @@ void FileTreeModel::sort(int column, Qt::SortOrder order)
m_sort.column = column;
m_sort.order = order;
- sortItem(*m_root);
+ sortItem(*m_root, false);
}
FileTreeItem* FileTreeModel::itemFromIndex(const QModelIndex& index) const
@@ -487,7 +487,7 @@ void FileTreeModel::update(
}
if (added) {
- parentItem.sort(m_sort.column, m_sort.order);
+ parentItem.sort(m_sort.column, m_sort.order, true);
}
}