mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
Put directories first when sorting torrent content by name
Closes #1594.
This commit is contained in:
parent
d02984cbed
commit
bdf27451ad
1 changed files with 13 additions and 5 deletions
|
@ -90,12 +90,20 @@ bool TorrentContentFilterModel::lessThan(const QModelIndex &left, const QModelIn
|
||||||
Q_ASSERT(vL.isValid());
|
Q_ASSERT(vL.isValid());
|
||||||
Q_ASSERT(vR.isValid());
|
Q_ASSERT(vR.isValid());
|
||||||
|
|
||||||
|
TorrentContentModelItem::ItemType leftType, rightType;
|
||||||
|
leftType = m_model->itemType(m_model->index(left.row(), 0, left.parent()));
|
||||||
|
rightType = m_model->itemType(m_model->index(right.row(), 0, right.parent()));
|
||||||
|
if (leftType == rightType) {
|
||||||
bool res = false;
|
bool res = false;
|
||||||
if (misc::naturalSort(vL.toString(), vR.toString(), res))
|
if (misc::naturalSort(vL.toString(), vR.toString(), res))
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
return QSortFilterProxyModel::lessThan(left, right);
|
return QSortFilterProxyModel::lessThan(left, right);
|
||||||
}
|
}
|
||||||
|
else if (leftType == TorrentContentModelItem::FolderType && sortOrder() == Qt::AscendingOrder)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return QSortFilterProxyModel::lessThan(left, right);
|
return QSortFilterProxyModel::lessThan(left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue