summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/storemodel.cpp16
-rw-r--r--src/storemodel.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/src/storemodel.cpp b/src/storemodel.cpp
index b6fef94c..06c3c036 100644
--- a/src/storemodel.cpp
+++ b/src/storemodel.cpp
@@ -256,3 +256,19 @@ bool StoreModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
}
return true;
}
+
+bool StoreModel::lessThan(const QModelIndex &source_left,
+ const QModelIndex &source_right) const {
+/* matches logic in QFileSystemModelSorter::compareNodes() */
+#ifndef Q_OS_MAC
+ if (fs && (source_left.column() == 0 || source_left.column() == 1)) {
+ bool leftD = fs->isDir(source_left);
+ bool rightD = fs->isDir(source_right);
+
+ if (leftD ^ rightD)
+ return leftD;
+ }
+#endif
+
+ return QSortFilterProxyModel::lessThan(source_left, source_right);
+}
diff --git a/src/storemodel.h b/src/storemodel.h
index 66486b10..6c8053e9 100644
--- a/src/storemodel.h
+++ b/src/storemodel.h
@@ -23,6 +23,8 @@ public:
bool ShowThis(const QModelIndex) const;
void setModelAndStore(QFileSystemModel *sourceModel, QString passStore);
QVariant data(const QModelIndex &index, int role) const;
+ bool lessThan(const QModelIndex &source_left,
+ const QModelIndex &source_right) const override;
// QAbstractItemModel interface
public: