From 27c4861907d57c3e2b79bc476972325a6d6efa49 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Tue, 23 Feb 2021 19:16:18 +0100 Subject: Fix sorting by priority when grouping by priority. --- src/modlistsortproxy.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/modlistsortproxy.cpp') 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(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; -- cgit v1.3.1