summaryrefslogtreecommitdiffstats
path: root/src/storemodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/storemodel.cpp')
-rw-r--r--src/storemodel.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/storemodel.cpp b/src/storemodel.cpp
index a46e1b03..06c3c036 100644
--- a/src/storemodel.cpp
+++ b/src/storemodel.cpp
@@ -80,6 +80,7 @@ bool StoreModel::ShowThis(const QModelIndex index) const {
*/
void StoreModel::setModelAndStore(QFileSystemModel *sourceModel,
QString passStore) {
+ setSourceModel(sourceModel);
fs = sourceModel;
store = std::move(passStore);
}
@@ -255,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);
+}