PDA

View Full Version : Sort columns using "standard" order, not ASCIIbetical order



tarod
28th September 2012, 07:38
My column has the values "A", "a", "B", "b", "C" y "c".

Using sortByColumn, the result is "A, B, C, a, b, c" (ASCIIbetical (http://en.wikipedia.org/wiki/ASCII) order) instead of "a, A, b, B, c, C" ("standard" order or usual order)

Could you help me to solve the problem?

I need a simple solution. Any Qt solution based on its own classes?

Thanks.

Kampfgnom
28th September 2012, 11:21
Are you using the Model/View classes? You could try using the QSortFilterProxyModel and see if this sorts the way you want it to. Otherwise you could have to implement your own QAbstractProxyModel.

tarod
28th September 2012, 13:51
Are you using the Model/View classes? You could try using the QSortFilterProxyModel and see if this sorts the way you want it to. Otherwise you could have to implement your own QAbstractProxyModel.

Do you know any site where I can see an example?

Thanks.

wysota
28th September 2012, 14:01
Reimplement QAbstractItemModel::sort() or QSortFilterProxyModel::lessThan() and implement comparison operator that fits your needs.