问题
How to add spaces between table cells using QSS selectors. I've tried the border-spacing selector, the item pseudo-class with the border selector, but it all doesn't work as it should.
Here is a sample code that I thought was supposed to do this.
app. setStyleSheet ("QTableView { border-collapse: separate; border-spacing: 10px 20px; color: red;}")
Here's a picture of what I mean.
回答1:
With style-sheets, you are either able to separate the individual cells via border-spacing (as in your example), or via padding:
app.setStyleSheet("QTableView::item { border:0px; padding: 150px; }")
来源:https://stackoverflow.com/questions/64930371/changing-the-spacing-between-qtableview-cells-using-stylesheet-in-pyqt5