From 9c2fc694051b8e500a3343322dd45cf8be1c1b7d Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 7 Feb 2020 11:26:11 -0500 Subject: sort on demand --- src/filetreemodel.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/filetreemodel.h') diff --git a/src/filetreemodel.h b/src/filetreemodel.h index 1bc7f73b..deb6d092 100644 --- a/src/filetreemodel.h +++ b/src/filetreemodel.h @@ -34,6 +34,13 @@ public: Q_DECLARE_FLAGS(Flags, Flag); + struct SortInfo + { + int column = 0; + Qt::SortOrder order = Qt::AscendingOrder; + }; + + FileTreeModel(OrganizerCore& core, QObject* parent=nullptr); void setFlags(Flags f) @@ -48,6 +55,8 @@ public: bool enabled() const; void setEnabled(bool b); + const SortInfo& sortInfo() const; + QModelIndex index(int row, int col, const QModelIndex& parent={}) const override; QModelIndex parent(const QModelIndex& index) const override; int rowCount(const QModelIndex& parent={}) const override; @@ -63,12 +72,6 @@ public: FileTreeItem* itemFromIndex(const QModelIndex& index) const; private: - struct Sort - { - int column = 0; - Qt::SortOrder order = Qt::AscendingOrder; - }; - class Range; using DirectoryIterator = std::vector::const_iterator; @@ -80,7 +83,7 @@ private: mutable IconFetcher m_iconFetcher; mutable std::vector m_iconPending; mutable QTimer m_iconPendingTimer; - Sort m_sort; + SortInfo m_sort; bool m_fullyLoaded; bool showConflictsOnly() const -- cgit v1.3.1