summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikaël Capelle <capelle.mikael@gmail.com>2021-02-23 19:16:18 +0100
committerMikaël Capelle <capelle.mikael@gmail.com>2021-02-23 19:16:18 +0100
commit27c4861907d57c3e2b79bc476972325a6d6efa49 (patch)
tree801bd92adb6d7ba68536d35bfa3f52bcf0368ece
parent8decb9df6831a2b953b122cd509361eb1539e84e (diff)
Fix sorting by priority when grouping by priority.
-rw-r--r--src/modlistsortproxy.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp
index fc7f3270..4084af24 100644
--- a/src/modlistsortproxy.cpp
+++ b/src/modlistsortproxy.cpp
@@ -108,6 +108,12 @@ bool ModListSortProxy::lessThan(const QModelIndex &left,
if (sortColumn() != ModList::COL_PRIORITY) {
return QSortFilterProxyModel::lessThan(left, right);
}
+ else if (qobject_cast<QtGroupingProxy*>(sourceModel())) {
+ // if the underlying proxy is a QtGroupingProxy we need to rely on
+ // Qt::DisplayRole because the other roles are not correctly handled
+ // by that kind of proxy
+ return left.data(Qt::DisplayRole).toInt() < right.data(Qt::DisplayRole).toInt();
+ }
}
bool lOk, rOk;