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?

[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.3k 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.
  • I Offline
    I Offline
    Ithrayen
    wrote on 9 Sept 2014, 16:06 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
    • D Offline
      D Offline
      dheerendra
      Qt Champions 2022
      wrote on 9 Sept 2014, 16:47 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 10 Sept 2014, 11:11 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

        1/3

        9 Sept 2014, 16:06

        • Login

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