如何在 QTableWidget 中隐藏垂直/​​水平线 [英] How to hide vertical/horizontal lines in QTableWidget

查看:69
本文介绍了如何在 QTableWidget 中隐藏垂直/​​水平线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Python 中使用 Pyqt4 进行 GUI 编程.如何在 QTableWidget 中隐藏垂直或水平线?

I am using Pyqt4 for GUI programming in python. How can I hide vertical or horizontal lines in QTableWidget?

推荐答案

尝试:

yourTableWidget.setShowGrid(False)

不幸的是,似乎没有通过样式表做到这一点的好方法.一种解决方法是将 gridline-color: 设置为与 background-color: 相同.

Unfortunately there seems to be no good way to do this via Stylesheets. A workaround is to set gridline-color: the same as background-color:.

如果您只想禁用垂直水平线,请在代码中关闭网格,并使用 QTableView::item 选择器为每个项目绘制边框.

If you want to disable just vertical or horizontal lines, turn the grid off in code, and draw the borders per item with the QTableView::item selector.

这篇关于如何在 QTableWidget 中隐藏垂直/​​水平线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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