[Development] Using QCollator on different platforms, without ICU

Knoll Lars Lars.Knoll at digia.com
Thu Aug 15 13:13:45 CEST 2013

On 14.08.13 17:30, "Thiago Macieira" <thiago.macieira at intel.com> wrote:

>On quarta-feira, 14 de agosto de 2013 14:54:53, Aleix Pol wrote:
>> On Tue, Aug 13, 2013 at 8:08 PM, Thiago Macieira
>> > However much I dislike common denominators, what is the common
>> > API
>> > that we can provide in all platforms?
>> Hi!
>> I've put together a small table displaying whether the different
>> methods/properties can be implemented in the different platforms:
>> https://qt-project.org/wiki/QCollator
>What do you mean by "collation N" in all the columns? Do you mean we
>can't set 
>the collation type from QCollation::Collation? If so, that's quite
>the class should default to whatever the collation type is for the locale.

Agree. Let's leave that out of the public API in this case though.
>identifier: it would probably return "System" and that would be fine.

Actually it would only do that for POSIX. Mac and windows can collate
according to a given locale (LCID on windows), so the identifier would be
dependent on that. We can create that identifier on Windows, as we have a
mapping from LCID to bcp47 names in QLocale. Something similar should be
possible on Mac
>casePreference: looks like we can do case sensitive and insensitive,
>Sounds like an acceptable compromise. For POSIX, we can implement case-
>insensitive collation by lowercasing, even though that might introduce

The errors are small enough to be acceptable (as it won't sort as people
expect anyway).
>numericMode: this is what KDE wants. We can write our own algorithm.

Yes, that's doable. Sort according to numeric prefix, and only if equal
send the remaining string through the system API.
>sortKey: the lack of OS X support is worrying... didn't they have just a
>simple wrapper around ICU?

Yes, that's weird. I'd propose to load the required symbol dynamically
from ICU on Mac.
>indexCharacters: we can return the English ones and see what happens...

We could actually hard code this for some of the more commonly used
locales if required, and return the english ones as a fallback.


>> PS: I also hope it's ok to create new wiki pages like that :)
>Thiago Macieira - thiago.macieira (AT) intel.com
>  Software Architect - Intel Open Source Technology Center

More information about the Development mailing list