I'm using Qt4 to create a table, using the QTableWidget
class.
Problem is: I want to hide the row labels (i.e. the numbers). I just care about columns. I want to get this:
(source: ldc.usb.ve)
How can I accomplish this?
By default, field labels are shown. To hide or show field labels, select Analysis > Table Layout > Show Field Labels for Rows or Show Field Labels for Columns.
Follow these steps to hide the buttons: Right-click a cell in the pivot table and, in the pop up menu, click PivotTable Options. In the Display section, remove the check mark from Show Expand/Collapse Buttons. This change will hide the Expand/Collapse buttons to the left of the outer Row Labels and Column Labels.
Click the Format button located on the Home tab / Cells group then choose Hide Columns or Rows (another option is to Right click on a highlighted column or row heading and select hide). Your Columns and Rows are now hidden.
Method 1 - Hide/Show Excel worksheet Row and Column headings from Excel Ribbon. Step 1 - Click on "View" Tab on Excel Ribbon. Step 2 - Go to "Show" Group in Ribbon's "View" Tab. Step 3 - Uncheck "Headings" checkbox to hide Excel worksheet Row and Column headings.
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-
Appearance
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With