Merge pull request #8091 from sledgehammer999/fix_natural_sort

Fix natural sorting
This commit is contained in:
sledgehammer999 2017-12-23 19:16:29 +02:00 committed by GitHub
commit c5127d2eec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -85,7 +85,10 @@ namespace
const QChar leftChar = (m_caseSensitivity == Qt::CaseSensitive) ? left[posL] : left[posL].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
++posL;
++posR;