1

我用它来设置我的QTableWidget. horizontalheaderlabels除了and之外,表中的所有内容都会受到影响the row numbers

Table.setStyleSheet("Background-color:rgb(100,100,100);border-radius:15px;")

所以我尝试了这个

Table.horizontalHeader().setStyleSheet("Background-color:rgb(190,1,1);border-radius:14px;"

但这似乎没有任何影响。

如何设置和的样式horizontalheaderlabelthe row numbers

4

1 回答 1

7

你应该检查Qt Sylesheet Reference

你必须做类似的事情

stylesheet = "::section{Background-color:rgb(190,1,1);border-radius:14px;}"
Table.horizontalHeader().setStyleSheet(stylesheet)

也就是说,如果您想要不同的水平和垂直标题。否则,这应该可以完成工作

stylesheet = "QHeaderView::section{Background-color:rgb(190,1,1);
                                   border-radius:14px;}"
Table.setStyleSheet(stylesheet)
于 2013-10-07T07:45:09.537 回答