I'm developing a small interface in pyqt5 from QT Designer, this includes a QTableWidget but I want to assign different widths to the columns, I have found topics that talk about the same but I don't know exactly where to insert the code they provide, I don't know if it's because of the version, I'm quite new in QT Designer.
I leave the questions I mention for what it's worth.
PyQt:How do i set different header sizes for individual headers?
The structure of my files is as follows:
app.py: Stores the functionalities of the application
SGS.py: The code that is generated after converting the .ui file to .py
SGS.ui
I leave the SGS.py part where the table headers are generated for what it's worth.
item = self.TableDocs.horizontalHeaderItem(0)
item.setText(_translate("MainWindow", "IDsystem"))
item = self.TableDocs.horizontalHeaderItem(2)
item.setText(_translate("MainWindow", "IDpeople"))
item = self.TableDocs.horizontalHeaderItem(3)
item.setText(_translate("MainWindow", "Work"))
item = self.TableDocs.horizontalHeaderItem(4)
item.setText(_translate("MainWindow", "Hours"))
I also leave the code with which I fill the table
result = Cur.execute("SELECT idsystem,IDpeople,work,hours FROM workers")
self.TableDocs.setRowCount(0)
for row_number, row_data in enumerate(result):
self.TableDocs.insertRow(row_number)
for column_number, data in enumerate(row_data):
self.TableDocs.setItem(row_number, column_number, QtWidgets.QTableWidgetItem(str(data)))