Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Forum Updated on Feb 6th

    How do I implement multi-column spanning horizontal headings with QTableView?

    General and Desktop
    1
    1
    1484
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      aknudsen last edited by

      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].

      1 Reply Last reply Reply Quote 0
      • First post
        Last post