【问题标题】:How to set the column width to be the whole QTableWidget width?如何将列宽设置为整个 QTableWidget 宽度?
【发布时间】:2017-01-19 13:35:29
【问题描述】:

我有一个 QTableWidget 类型的对象。它只包含一列。 如何将列宽设置为整个 QTableWidget 宽度?

另外:有没有办法删除列的标题?

【问题讨论】:

  • tableWidget.horizontalHeader().hide().

标签: python pyqt width pyqt5 qtablewidget


【解决方案1】:

尝试使用以下内容(假设您的表格小部件名为 tableWidget)...

tableWidget.horizontalHeader().setStretchLastSection(True)

【讨论】:

  • 我找到了 **self.horizo​​ntalHeader().setSectionResizeMode(0,QtWidgets.QHeaderView.Stretch) ** 但是你的方法更容易阅读 ;) thx :)
猜你喜欢
  • 2021-12-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-06-11
相关资源
最近更新 更多