How can I enable / disable QTableWidget's horizontal / vertical header?
You'd get the header and .hide()
(or .setVisible(False)
:
self.ui.tblContents.horizontalHeader().hide()
# or
# self.ui.tblContents.horizontalHeader().setVisible(False)
self.ui.tblContents.verticalHeader().hide()
# or
# self.ui.tblContents.verticalHeader().setVisible(False)
In case you want to do that using QTableWidget() for Python37 PyQt5. Here are the steps to hide both Vertical and Horizontal:
Initialize the widget, i mentioned it to make it easy on you to locate the the steps:
self.tableWidget = QTableWidget()
Hide Horizontal header
self.tableWidget.horizontalHeader().setVisible(False)
Hide vertical header
self.tableWidget.verticalHeader().setVisible(False)