How do I implement multi-column spanning horizontal headings with QTableView?
-
Hi guys
I need to implement a sortable table where the horizontal header has each header item span two columns, entailing that when a header item is clicked the two corresponding columns must be sorted together. How can I do this? I've implemented the suggested QHeaderView variation in the [url=http://qt-project.org/faq/answer/how_can_i_span_the_headers_in_my_qtableview]FAQ[/url], but the resulting header items don't participate in sorting, i.e., clicking them does not cause any sorting to occur. Also, the horizontal header isn't correctly offset from the left, and does not display my custom headings either (just the generic 1, 2, 3...).
Below is a screenshot of the multi-column span header, you should be able to see that the horizontal offset is wrong and that the horizontal headings are generic (1, 2, 3):
!http://i.stack.imgur.com/ndx0g.png(Screenshot)!
For the full code (in Python), see my [url=http://stackoverflow.com/questions/23869973/why-isnt-my-custom-horizontal-qheaderview-offset-from-the-left-and-why-wont-it]StackOverflow question[/url].