Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. [PyQt] QtableView Header. How to add top-right small button to hide/show column with checked/unchecked Checkboxes?
Forum Updated to NodeBB v4.3 + New Features

[PyQt] QtableView Header. How to add top-right small button to hide/show column with checked/unchecked Checkboxes?

Scheduled Pinned Locked Moved Language Bindings
3 Posts 2 Posters 5.8k Views 1 Watching
  • 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.
  • I Offline
    I Offline
    Ithrayen
    wrote on last edited by
    #1

    With PyQt4, I am using a QtableView with more than 10 columns. The user must have the choice of showing/hiding a column.

    This is generally done by adding a small button in the top-right of the table's header. The button shows a menu with checked/unchecked Checkboxes allowing to hide/show columns.

    This is an example of a Sqlite-Manager Table :http://williamsportwebdeveloper.com/cgi/wp/wp-content/uploads/2010/08/SQLiteManager.png.

    So, I wonder how can I do the same with PyQt's QtableView?

    Thanks,

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      I have not used PyQt. From Qt C++ perspective, you can get Header view for TableView and implement your own delegate to have checkboxes. Based on the actions on the delegate you can hide/show columns you want.

      Another possibility is to make two components separately

      1. Header Component and View Component
      2. Show them in vertical layout. You can handle the action of header component.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • I Offline
        I Offline
        Ithrayen
        wrote on last edited by
        #3

        Thanks Dheerendra,

        A solution was proposed "here":http://stackoverflow.com/questions/25744109/pyqt-qtableview-header-how-to-add-top-right-small-button-to-hide-show-column-wi/25752676?noredirect=1#comment40275860_25752676.

        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