Skip to content

Commit

Permalink
fix: lowercase item should appears first
Browse files Browse the repository at this point in the history
同为英文(ascii)字符时,小写应当在大写前面。

注:根据目前的测试,QCollator 的 compare 看上去并不满足这种排序要求...

Issue: linuxdeepin/developer-center#6159
Log:
  • Loading branch information
BLumia committed Nov 13, 2023
1 parent d5889c6 commit 9168f14
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/models/categorizedsortproxymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ bool CategorizedSortProxyModel::lessThan(const QModelIndex &source_left, const Q
if ((l_start == ld_start && ld_start == rd_start) || (l_start != ld_start && l_start != rd_start)) {
// display name both start with ascii letter, or both NOT start with ascii letter
// use their transliterated form for sorting
if (!l_start.isNull() && l_transliterated.constData()[0] != r_transliterated.constData()[0]) {
// Since in ascii table, `A` is lower than `a`, we specially check to ensure `a` is lower here.
return l_transliterated.constData()[0].isLower();
}
return l_transliterated < r_transliterated;
} else {
// one of them are ascii letter and another of them is non-ascii letter.
Expand Down

0 comments on commit 9168f14

Please sign in to comment.