mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 13:48:05 -06:00
Merge pull request #14717 from Chocobo1/ncmp
Simplify natural sort classes interface
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "peerlistsortmodel.h"
|
||||
|
||||
#include "base/utils/string.h"
|
||||
#include "peerlistwidget.h"
|
||||
|
||||
PeerListSortModel::PeerListSortModel(QObject *parent)
|
||||
@@ -43,11 +42,10 @@ bool PeerListSortModel::lessThan(const QModelIndex &left, const QModelIndex &rig
|
||||
{
|
||||
case PeerListWidget::IP:
|
||||
case PeerListWidget::CLIENT:
|
||||
{
|
||||
{
|
||||
const QString strL = left.data(UnderlyingDataRole).toString();
|
||||
const QString strR = right.data(UnderlyingDataRole).toString();
|
||||
const int result = Utils::String::naturalCompare(strL, strR, Qt::CaseInsensitive);
|
||||
return (result < 0);
|
||||
return m_naturalLessThan(strL, strR);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
#include "base/utils/compare.h"
|
||||
|
||||
class PeerListSortModel final : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -45,4 +47,6 @@ public:
|
||||
|
||||
private:
|
||||
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
|
||||
|
||||
Utils::Compare::NaturalLessThan<Qt::CaseInsensitive> m_naturalLessThan;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user