[Interest] efficient natural sorting

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Wed Nov 14 15:57:03 CET 2018


Hi,

Il 14/11/18 03:28, Frank Rueter | OHUfx ha scritto:
> This works nicely but I’m wondering if it’s reliable and efficient to 
> implement it like this in the QSortFilterProxyModel.lessThan() method?!
> 
> |def lessThan(self, source_left, source_right): 
> natural_keys(source_left) < natural_keys(source_right) |
> 
> Any thoughts on this?

You can use QCollator to implement natural sorting (by enabling the 
numeric mode). Or doesn't it work for your use case?

My 2 c,
-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4007 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181114/e2714191/attachment.bin>


More information about the Interest mailing list