From d7aa0819d9eb3dd28126efbc3fa49a62e7ba0a10 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Thu, 16 Aug 2018 00:32:55 +0800 Subject: [PATCH] Fix values sorted wrong in "Last Activity" column I suspect there could be other negative values. Closes #9012. Also apply the changes to TR_RATIO_LIMIT, avoiding similar problems. --- src/gui/transferlistsortmodel.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gui/transferlistsortmodel.cpp b/src/gui/transferlistsortmodel.cpp index 69ecb3eaa..22a417d0c 100644 --- a/src/gui/transferlistsortmodel.cpp +++ b/src/gui/transferlistsortmodel.cpp @@ -183,23 +183,23 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex } case TransferListModel::TR_LAST_ACTIVITY: { - const qlonglong vL = left.data().toLongLong(); - const qlonglong vR = right.data().toLongLong(); + const int vL = left.data().toInt(); + const int vR = right.data().toInt(); - if (vL == -1) return false; - if (vR == -1) return true; + if (vL < 0) return false; + if (vR < 0) return true; - return vL < vR; + return (vL < vR); } case TransferListModel::TR_RATIO_LIMIT: { - const qreal vL = left.data().toDouble(); - const qreal vR = right.data().toDouble(); + const qreal vL = left.data().toReal(); + const qreal vR = right.data().toReal(); - if (vL == -1) return false; - if (vR == -1) return true; + if (vL < 0) return false; + if (vR < 0) return true; - return vL < vR; + return (vL < vR); } default: {