[Interest] About model/view sorting and headers

Yves Bailly yves.bailly at sescoi.fr
Mon Mar 5 14:31:12 CET 2012

Greetings all,

Here's something it seems I can't understand.

Let's say I have a model, a subclass from QStandardItemModel, filled
with a table-like set of data, creating as much QStandardItem as needed
and calling QStandardItemModel::appendRow(). This model contains both
an horizontal header (things like "ID", "Name", ...) and a vertical
header (things like "rec1", "rec2", ...).

This model is displayed in a standard QTableView, which allows sorting
simply by clicking on the horizontal header. When I click, the rows are
sorted, fine... but the rows' *headers* are not sorted.

What am I missing here? How can I get the vertical header to be sorted
just like the rows are sorted?

Thanks for any hint!

      /- Yves Bailly - Software developper  -\
      \- Sescoi R&D  - http://www.sescoi.fr -/
"The possible is done. The impossible is being done. For miracles,
thanks to allow a little delay."

More information about the Interest mailing list