Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] QHeaderView ContextMenu: QTableView vs. QTreeView

[SOLVED] QHeaderView ContextMenu: QTableView vs. QTreeView

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 5.8k Views
  • 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 Offline
    K Offline
    Knacktus
    wrote on last edited by
    #1

    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
    0
    • T Offline
      T Offline
      tony
      wrote on last edited by
      #2

      Good :)

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

      T.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved