Results 1 to 3 of 3

Thread: Cannot hide QTableWidget's vertical header.

  1. #1
    Join Date
    Oct 2013
    Posts
    142
    Thanks
    36
    Thanked 3 Times in 3 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Cannot hide QTableWidget's vertical header.

    I am trying to hide the vertical header of a QTableWidget but I get error.
    What I learned from all similar questions is that I need to use
    Qt Code:
    1. tableWidget->verticalHeader()->setVisible(false);
    To copy to clipboard, switch view to plain text mode 

    But I get the following error:
    Qt Code:
    1. error: invalid use of incomplete type 'class QHeaderView'
    2. tableWidget->verticalHeader()->setVisible(false);
    To copy to clipboard, switch view to plain text mode 

    I am using Qt 5.2


    Added after 39 minutes:


    Solved it using
    Qt Code:
    1. vh=new QHeaderView(Qt::Vertical);
    2. vh->hide();
    3. tableWidget->setVerticalHeader(vh);
    To copy to clipboard, switch view to plain text mode 
    Last edited by adutzu89; 25th January 2014 at 12:09.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Cannot hide QTableWidget's vertical header.

    incomplete type means that the compiler does not know any details about the class QHeaderView, it just knows that it exists, but not which methods it has.

    Include the header for the class.
    Qt Code:
    1. #include <QHeaderView>
    To copy to clipboard, switch view to plain text mode 


    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    adutzu89 (25th January 2014)

  4. #3
    Join Date
    Oct 2013
    Posts
    142
    Thanks
    36
    Thanked 3 Times in 3 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Cannot hide QTableWidget's vertical header.

    That is a cleaner way you post it......sorry I mistakenly included QTableView instead of QHeaderView

Similar Threads

  1. change Qtablewidget vertical header displayrole
    By advseo32 in forum Qt Programming
    Replies: 10
    Last Post: 12th August 2013, 14:21
  2. Replies: 1
    Last Post: 6th August 2013, 22:44
  3. Replies: 3
    Last Post: 20th January 2011, 14:24
  4. Vertical Header For QTreeView
    By wirasto in forum Qt-based Software
    Replies: 1
    Last Post: 12th October 2010, 06:53
  5. No Sort Vertical Header
    By wirasto in forum Qt Programming
    Replies: 4
    Last Post: 1st July 2009, 11:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.