PDA

View Full Version : Dynamic sorting using proper column after adding a row.



kremuwa
28th September 2010, 23:38
I'm using QTableWidget to represent data. It's only text data in several columns so I don't need to implement special sorting - checking "sortingEnabled" checkbox in Designer is all of the work. But now I have added a functionality of creating a new row. I want to create it and immediatily sort the table to make it move to the right position. But it should be sorted using the data in appropriate column. By appropriate column I mean a column which header was lately clicked. How to determine which column was the key for sorting lately? How to sort it using this column?

ChrisW67
28th September 2010, 23:50
QHeaderView::sortIndicatorSection(), QHeaderView::sortIndicatorOrder(),
QTableView::sortByColumn() look promising