Important: Please read the Qt Code of Conduct -

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=]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):


    For the full code (in Python), see my [url=]StackOverflow question[/url].

Log in to reply