如何让 QTableWidget 的列占据最大空间? [英] How to make QTableWidget's columns assume the maximum space?

查看:61
本文介绍了如何让 QTableWidget 的列占据最大空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 QTableWidget 的列没有填充表格的空间,因此在右侧留下了一个空白空间.如何让我的 QTableWidget 的列占据最大空间以填充这个空间?

The columns of my QTableWidget do not fill in the space of the table, so that an empty space is left on the right hand-side. How to make the columns of my QTableWidget assume the maximum space so as to fill in this space?

推荐答案

标题该表具有控制此的方法:

The headers of the table have methods for controlling this:

header = table.horizontalHeader()
header.setStretchLastSection(True)

或:

header.setResizeMode(QHeaderView.Stretch)

这篇关于如何让 QTableWidget 的列占据最大空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆