How to load data in column based on previous settings.
I am using QTableView to display data available in myfile.csv. It is working fine but I have another requirement which I have no clue:(.
Let say my table has 20 columns out of them one user is particularly interested in 10 columns, say column# 3,5,9,13,15,....20 and he shifted them together in the table by mouse dragging. Now I wanted to remember this setting for the current session. So that when user will open next CSV file, columns will be automatically arranged as per the last setting. He need not to do anything again.
Note: I can do it by remembering new column index with actual column index and put the data accordingly but it will be complex. Wondering if any other way is available to achieve the same.
For storing values obtained in previous sessions typically "QSettings":http://developer.qt.nokia.com/doc/qt-4.8/qsettings.html is used.
I do it this way:
// to store the state:
// to restore the state:
QByteArray tvState = s.value("TableViewState").toByteArray();