📜  pyqt5 更改表格小部件列宽 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:56.988000             🧑  作者: Mango

代码示例1
header = self.table.horizontalHeader()       
header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents)
header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents)
#the first column will stretch to fill the window and the others will resize 
#to the contents. If you want them to be equally sized change all resize modes
#to QtWidgets.QHeaderView.Stretch