[Qt-interest] Restoring sorting of QTableView
RZ
rz at razfazz.at
Thu Jun 11 23:09:08 CEST 2009
Hi,
i got a somewhat simple problem one might think but I did not find an
elegant solution.
I'm reading a file and appending each line as a new row in my model.
Each row is parsed while reading so I end up having a table with several
columns and the ordering of the lines is "natural" (that is as they are
in the file). The rows can be sorted and filtered (via
QSortFilterProxyModel) which works just fine.
But: how to restore the original ordering of the data? Because if the
user clicks e.g. column B data will be sorted accordingly but there is
no way to "unsort" (read: present the data as it was before sorting when
loaded).
Interestingly the line numbers of the vertical header view are also
"sorted" - so one might think that there must be a way to represent the
data according to the numbers of the lines in the header view but I
didn't find anything about it. Of course I could have a column holding
the line number and present that to the user - but this would be nothing
different than reimplementing the vertical header view myself ...
Does anyone know about a more elegant solution?
Regards,
Roland
More information about the Qt-interest-old
mailing list