PDA

View Full Version : Cannot hide QTableWidget's vertical header.



adutzu89
25th January 2014, 12:09
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
tableWidget->verticalHeader()->setVisible(false);

But I get the following error:

error: invalid use of incomplete type 'class QHeaderView'
tableWidget->verticalHeader()->setVisible(false);

I am using Qt 5.2

Added after 39 minutes:

Solved it using

vh=new QHeaderView(Qt::Vertical);
vh->hide();
tableWidget->setVerticalHeader(vh);

anda_skoa
25th January 2014, 12:10
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.


#include <QHeaderView>



Cheers,
_

adutzu89
25th January 2014, 12:12
That is a cleaner way you post it......sorry I mistakenly included QTableView instead of QHeaderView