-
Table Sorting
I have a QTable in Qt 3.3.7 and have it working so I can sort the columns. The one problem is some of my columns contain numerical values and the QTable only sorts by strings. So if I have the numbers 1-30 in a row in my table and I sort that row from lowest to highest, 10-19 is lower than 2 and anything else because "1" comes before "2" in a string. So how do I need to go about doing this? Is there a nice convenience in Qt 3 that I am just not seeing? Thanks for your help!
-
Re: Table Sorting
-
Re: Table Sorting
I have looked at the example but I don't know how this helps me. I am storing data into a QTable and I don't have the ability to overwrite a compare function like the QListViewItem has. I am storing QVariant data into the QTable. I feel like I need a QTable over a QListView because I need to be able to hide and show rows and do not see how to do this with a QListView. Or is there an easy way to show/hide rows (not columns) inside a QListView? Does anybody else have any other ideas?
-
Re: Table Sorting
I have read in many places where it says to modify QTableItem::key( ) for sorting purposes but how do I set it up so I can return an integer for 3 columns in my table and a QString for the other 4 columns in my table? I don't see how it can have 2 different return types and how it will know which column calls it so it will know which return type to return. Thanks!