mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 12:59:56 -07:00
Merge pull request #8091 from sledgehammer999/fix_natural_sort
Fix natural sorting
This commit is contained in:
commit
c5127d2eec
1 changed files with 4 additions and 1 deletions
|
@ -85,7 +85,10 @@ namespace
|
||||||
|
|
||||||
const QChar leftChar = (m_caseSensitivity == Qt::CaseSensitive) ? left[posL] : left[posL].toLower();
|
const QChar leftChar = (m_caseSensitivity == Qt::CaseSensitive) ? left[posL] : left[posL].toLower();
|
||||||
const QChar rightChar = (m_caseSensitivity == Qt::CaseSensitive) ? right[posR] : right[posR].toLower();
|
const QChar rightChar = (m_caseSensitivity == Qt::CaseSensitive) ? right[posR] : right[posR].toLower();
|
||||||
if (leftChar == rightChar) {
|
// Compare only non-digits.
|
||||||
|
// Numbers should be compared as a whole
|
||||||
|
// otherwise the string->int conversion can yield a wrong value
|
||||||
|
if ((leftChar == rightChar) && !leftChar.isDigit()) {
|
||||||
// compare next character
|
// compare next character
|
||||||
++posL;
|
++posL;
|
||||||
++posR;
|
++posR;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue