如何在 QTableWidget 中隐藏垂直/​​水平线

Zeb*_*Zeb 2 python pyqt4 qtablewidget

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

Bos*_*ash 7

尝试:

yourTableWidget.setShowGrid(False)
Run Code Online (Sandbox Code Playgroud)

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

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