QT:QTableWidget表头设置问题

喜欢月亮的向日葵 2021-03-25 07:35:23
QTableWidget设置完表头后表格最左上角的空白区如何设置成和表头一致?像图片中的最左上角的空白区设置样式并添加文字
...全文
842 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
xqhrs232 2021-03-26
  • 打赏
  • 举报
回复
引用 4 楼 hitzsf 的回复:
The corner widget in a QTableView is implemented as a QAbstractButton and can be styled using the "QTableView QTableCornerButton::section" selector.
这个牛!!!
xqhrs232 2021-03-26
  • 打赏
  • 举报
回复
QTableView Supports the box model. When alternating row colors is enabled, the alternating colors can be styled using the alternate-background-color property. The color and background of the selected item is styled using selection-color and selection-background-color respectively. The corner widget in a QTableView is implemented as a QAbstractButton and can be styled using the "QTableView QTableCornerButton::section" selector. Warning: If you only set a background-color on a QTableCornerButton, the background may not appear unless you set the border property to some value. This is because, by default, the QTableCornerButton draws a native border which completely overlaps the background-color. The color of the grid can be specified using the gridline-color property. See QAbsractScrollArea to style scrollable backgrounds. See Customzing QTableView for an example.
hitzsf 2021-03-26
  • 打赏
  • 举报
回复
官档的资料的确很牛
hitzsf 2021-03-25
  • 打赏
  • 举报
回复
The corner widget in a QTableView is implemented as a QAbstractButton and can be styled using the "QTableView QTableCornerButton::section" selector.
  • 打赏
  • 举报
回复
引用 2 楼 咸鱼DoYoung 的回复:
可以隐藏垂直表头,就没有那个空白区域了呀
我的这个项目需要把空白区设置成和表头一样,因为QTableWidget点击空白区所有行和列都全选了我需要这个功能
咸鱼DoYoung 2021-03-25
  • 打赏
  • 举报
回复
可以隐藏垂直表头,就没有那个空白区域了呀
  • 打赏
  • 举报
回复
知道的大佬回复一下哈,谢谢

16,203

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧