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. How to Remove the Header in QTableView?

How to Remove the Header in QTableView?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.3k 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.
  • J Offline
    J Offline
    JoyRider
    wrote on last edited by
    #1

    As shown in the Image below, How can i remove the unwanted header section ?

    ![IMG]http://i.imgur.com/DAmMlv5.png[/IMG](TableView Header)!

    I tried using setStretchLastSection(), But I don't want to stretch it. Without Stretching the Last Section how can i remove the Header part.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      thEClaw
      wrote on last edited by
      #2

      "QHeaderView * QTableView::horizontalHeader() const":http://qt-project.org/doc/qt-5.1/qtwidgets/qtableview.html#horizontalHeader
      and
      "void QHeaderView::hideSection(int logicalIndex)":http://qt-project.org/doc/qt-5.1/qtwidgets/qheaderview.html#hideSection
      maybe?

      You can also use
      "QAbstractItemModel * QAbstractItemView::model() const":http://qt-project.org/doc/qt-5.1/qtwidgets/qabstractitemview.html#model
      and then either hide the section or completely remove that column.

      Maybe I missed the point, but why is that last section different from the others? It shouldn't be - are you sure you are looking at this from the right angle?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Macro
        wrote on last edited by
        #3

        Did u tried using horizontalHeader->hideSection().

        Edit:

        Even u can make use of the Stylesheet to set the QHeaderView's Background to Transparent.

        @YourTable->setStyleSheet("QHeaderView {background-color: transparent;}")@

        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