[Interest] efficient natural sorting

Frank Rueter | OHUfx frank at ohufx.com
Thu Nov 15 23:37:22 CET 2018


I never have a' Original number" as the strings come from file names and 
another app.
QCollator is the ticket.

Cheers,
frank

On 15/11/18 4:14 AM, Shawn Rutledge wrote:
>> On 14 Nov 2018, at 03:28, Frank Rueter | OHUfx <frank at ohufx.com> wrote:
>>
>> Hi,
>>
>> I need to use the QSortFilterProxyModel to sort strings with numbers in them, i.e. perform natural sorting.
> Another idea is to add a different role to your model, have data() return the original number (int or qreal or whatever) in the variant for that role, and call setSortRole() to tell QSFPM which role to use.
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest




More information about the Interest mailing list