remove horizontal header of QTableView

QTableView will show the horizontal header and vertical header by default.

Now I want to use QTableView as a file list to show the files changed recently (I want to list more than one column, so QTableView is a better choice than QListView). we can use following code to remove the horizontal header:

PySide

c++

horizontalHeader() method will return the horizontal header which is an instance of QHeaderView class. Then call the hideĀ method of QHeaderView class to hide the header.

QHeaderView class is inheriting QWidget class, so we can use hide method to make it invisible and use show method to make it visible. You can view the QWidget documentation here