remove - tableau rename measure names
Hiding row labels (2)
I'm using Qt4 to create a table, using the QTableWidget class. I get something like this:
Problem is: I want to hide the row labels (i.e. the numbers). I just care about columns. I want to get this:
How can I accomplish this?
I was wondering about the same thing. However, I was too lazy to find a solution till you asked. (Thanks!!). Anyway, here is the code that worked for me:
table = QtGui.QTableWidget() table.verticalHeader().setVisible(False)
These are actually QTableView's methods. Since you use a QTableWidget which is a child of QTableView, everything works out.
I am not sure whether this is the best way to do this, but the QHeaderView documentation recommends this method. To quote the PyQt4 docs-
QTableWidget and QTableView create default headers. If you want the headers to be visible, you can use setVisible().
Note: Each header renders the data for each section itself, and does not rely on a delegate. As a result, calling a header's setItemDelegate() function will have no effect.
Now you can just use method:
inherited from QTreeView. It was introduced in Qt4.4.