Qt Forum

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

    [SOLVED] QHeaderView ContextMenu: QTableView vs. QTreeView

    General and Desktop
    2
    2
    5584
    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.
    • K
      Knacktus last edited by

      Edit: Arrg, I had a stupid typo which overwrote the setHeader() method. I'm using PyQt where those magic things are possible. Well, once in a year you'd like to have a compiler as Python user. ;-)
      All good now.

      Hi everyone,

      I have created a custom QHeaderView to be able to choose the colums to be shown by right-clicking on the header. (I want to control the columns on the model level).

      I'm using a context menu an a set of toggleable actions to get the behavior.

      Using this header in a QTableView works perfectly (using setHorizontalHeader).

      Now when I use the same header in a QTreeView using setHeader, the header is shown but the contextmenu does not appear.

      Has anyone experienced similiar behavior or any comments on this topic? Shouldn't I use the setContextMenuPolicy "shortcut" on a QHeaderView?

      Cheers,

      Jan

      1 Reply Last reply Reply Quote 0
      • T
        tony last edited by

        Good :)

        Let's reply, so we can move it away from "Unanswered posts" :)

        T.

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