Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to save the order of columns?

I currently have a tableview attached to a class that is derived from QSortFilterProxyModel. Now I wanted to know if there is any way by which I can store the order of columns since the users tend to move the columns back and forth. Also is there any signal that is emitted when a user changes the order of the columns.I search this but I cannot find anything that might tel me when a column is moved around and how i can save the tablew columns orders. Any suggetsions would be appreciated

like image 799
Rajeshwar Avatar asked Sep 28 '13 00:09

Rajeshwar


Video Answer


1 Answers

You need to obtain a QHeaderView object using QTableView::horizontalHeader. You can use QHeaderView::saveState and QHeaderView::restoreState to save state of columns. You can use QHeaderView::sectionMoved signal to detect column moving.

like image 64
Pavel Strakhov Avatar answered Sep 16 '22 21:09

Pavel Strakhov