Re: Sorting data in QTable
Why does it matter to you if the int is represented as string?
The sorting should give same results I think....
If you absolutely want to use integers, you will have to subclass QTableWidgetItem and use UserType.
Re: Sorting data in QTable
If you sorting with String the result will not get like Integer.
from 1-9 it sort well but after 9 the result like this
3
2
12
11
10
1
0
If possible can you send me the snippets of the code.It would be great help for me.
Re: Sorting data in QTable
[QUOTE][from 1-9 it sort well but after 9 the result like this/QUOTE]
One way of overcoming this is by adding '0's like that:
001
002
020
100
Then the strings will sort correct for the integers.
The other way is as I said, to subclass QTableWidgetItem.
[QUOTE][If possible can you send me the snippets of the code./QUOTE]
Snippets of what code?
Re: Sorting data in QTable
another method would be to use a table model so you have access to the integer data, sort that, and then in your 'data' method, you would convert the integer data to string data to be displayed by the table.