1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 15:27:54 +00:00

Merge pull request #14318 from Chocobo1/sorting

Reuse existing code for sorting
This commit is contained in:
Mike Tzou 2021-02-03 12:52:35 +08:00 committed by GitHub
commit 04275e7d5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -166,27 +166,7 @@ bool TransferListSortModel::lessThan_impl(const QModelIndex &left, const QModelI
return positionL != 0; return positionL != 0;
} }
// Sort according to TR_SEED_DATE return invokeLessThanForColumn(TransferListModel::TR_SEED_DATE);
const auto dateL = left.sibling(left.row(), TransferListModel::TR_SEED_DATE)
.data(TransferListModel::UnderlyingDataRole).toDateTime();
const auto dateR = right.sibling(right.row(), TransferListModel::TR_SEED_DATE)
.data(TransferListModel::UnderlyingDataRole).toDateTime();
if (dateL.isValid() && dateR.isValid())
{
if (dateL != dateR)
return dateL < dateR;
}
else if (dateL.isValid())
{
return false;
}
else if (dateR.isValid())
{
return true;
}
return hashLessThan();
} }
case TransferListModel::TR_SEEDS: case TransferListModel::TR_SEEDS: