I have a function that adds new column to the table, hoewer I do not know how to rename the column header. What I want is for the user to either double click on the column header so that you could edit the column header. or what I have now: I have a a button that adds a new column and line Edit where you write your column name.
I do not know how to rename the column header names
This is my code that handles adding new column to the table.
def addNewColumn(self):
self.tableColumn = self.table_Database.columnCount()
self.table_Database.setColumnCount(self.tableColumn + 1)
self.table_Database.setItem(0,self.tableColumn,QtWidgets.QTableWidgetItem())
if self.table_Database.rowCount() == 0:
self.table_Database.setRowCount(1)
self.table_Database.setItem(1,0,QtWidgets.QTableWidgetItem())
if you use a model.. See headerData... it defines the horizontal header... columns.