mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
Use locale- and platform-dependent comparison when sorting dictionaries (issue #676)
This commit is contained in:
parent
cabc5aa7c3
commit
7fa2df772e
|
@ -24,7 +24,7 @@ bool dictNameLessThan( sptr< Dictionary::Class > const & dict1,
|
|||
if( !str1.isEmpty() && str2.isEmpty() )
|
||||
return true;
|
||||
|
||||
return str1.compare( str2, Qt::CaseInsensitive ) < 0;
|
||||
return str1.localeAwareCompare( str2 ) < 0;
|
||||
}
|
||||
|
||||
bool dictLessThan( sptr< Dictionary::Class > const & dict1,
|
||||
|
@ -54,7 +54,7 @@ bool dictLessThan( sptr< Dictionary::Class > const & dict1,
|
|||
return false;
|
||||
if( !str1.isEmpty() && str2.isEmpty() )
|
||||
return true;
|
||||
int res = str1.compare( str2, Qt::CaseInsensitive );
|
||||
int res = str1.localeAwareCompare( str2 );
|
||||
if( res )
|
||||
return res < 0;
|
||||
|
||||
|
@ -64,7 +64,7 @@ bool dictLessThan( sptr< Dictionary::Class > const & dict1,
|
|||
return false;
|
||||
if( !str1.isEmpty() && str2.isEmpty() )
|
||||
return true;
|
||||
res = str1.compare( str2, Qt::CaseInsensitive );
|
||||
res = str1.localeAwareCompare( str2 );
|
||||
if( res )
|
||||
return res < 0;
|
||||
|
||||
|
@ -75,7 +75,7 @@ bool dictLessThan( sptr< Dictionary::Class > const & dict1,
|
|||
if( !str1.isEmpty() && str2.isEmpty() )
|
||||
return true;
|
||||
|
||||
return str1.compare( str2, Qt::CaseInsensitive ) < 0;
|
||||
return str1.localeAwareCompare( str2 ) < 0;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
Loading…
Reference in a new issue