naturalCompare Qt5 task

Thiago Macieira thiago at kde.org
Fri Jul 19 14:12:39 UTC 2013


On sexta-feira, 19 de julho de 2013, às 13.17.26, you wrote:
> Hi,
> I was looking at that task in the Qt5 epics list and I didn't understand it
> fully.
> 
> contribute natural-comparison to Qt5 (see KStringHandler). In Qt there is
> naturalCompare function but private and not as good as from KStringHandler.
> Thiago says: add the feature to QCollator.
> 
> Here's the problems I see:
> - I don't know what's the goal of the task, so it's hard for me to decide
> what to do.

QCollator does locale-based sorting ("collating") in a much more efficient way 
than element-by-element QString::localeAwareCompare can do.

The task is to add a set of methods to QCollator to do *natural* locale-based 
comparison.

> - The one Qt5 has now, it's in QFileSystemModel

So it's easy to move the code around.

> - QCollator is also a private class, do we need to have it available from
> the public API? I guess the only use of it is in any tier1 module. If so,
> why QCollator?

QCollator is meant to be made public. It wasn't yet because of the pending 
discussions on ICU.

> - In the code we have in KStringHandler we can find this comment:
> // This is based on the natural sort order code code by Martin Pool
> // http://sourcefrog.net/projects/natsort/
> // Martin Pool agreed to license this under LGPL or GPL.
> 
> I don't feel very comfortable with moving this code over to the Qt project.

For good reason: you can't.

You need to take the one on QFSM and adapt it, or write everything anew.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20130719/0f90d5df/attachment.sig>


More information about the Kde-frameworks-devel mailing list