PDA

View Full Version : Column Sorting



sumsin
15th June 2006, 13:27
Hi

In a QTable I am implementing the sorting, in which when user clicks one of the column the table sorted. Now the indexes of the rows have been changed.
Before sorting
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
After sorting
5, 9, 4, 2, 8, 6, 1, 3, 7, 0

Now when I try to get whose index is 9, it will not give me the right value instead of it return the value of 0th index which actually at position 10th(actual 9 index).

What should I do to get the right values.

sumsin
16th June 2006, 08:48
Hi

actually in my table I am using widgets in one of the column and in other columns I am using my sub-classed QTableItem, but when I click on one of the column say name then only that column is sorted but neither the widget column nor other column sort.

I read in Qt Docs when you widgets in a QTable and want to sort then you have to implement swapRows() or swapCells() explicitly, but I am not sure how should I reimplement them.

thanks.