Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding row labels

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:

alt text
(source: ldc.usb.ve)

How can I accomplish this?

like image 471
Emiliano Avatar asked Feb 23 '09 16:02

Emiliano


People also ask

How do I hide row labels in tableau?

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.

Can you hide row labels in pivot table?

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.

How do I hide a row and column headings in Excel?

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.

Can you hide row numbers in Excel?

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.


1 Answers

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.
like image 137
batbrat Avatar answered Oct 02 '22 23:10

batbrat