PyQt QTableWidget 水平标题标签样式表 [英] PyQt QTableWidget horizontalheaderlabel stylesheet
本文介绍了PyQt QTableWidget 水平标题标签样式表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用它来设置我的 QTableWidget
的样式.除了horizontalheaderlabels
和行号
,表中的所有内容都会受到影响.
I used this to set the style for my QTableWidget
. Everything in the table is affected except the 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;"
但这似乎没有任何影响.
But this doesn't seems to have any affect.
如何设置horizontalheaderlabel
和行号
的样式表?
How do i set the style sheet for horizontalheaderlabel
and the row numbers
?
推荐答案
你应该检查 Qt 样式表参考
你必须做类似的事情
stylesheet = "::section{Background-color:rgb(190,1,1);border-radius:14px;}"
Table.horizontalHeader().setStyleSheet(stylesheet)
也就是说,如果您想要不同的水平和垂直标题.否则,这应该可以完成工作
That is if you want different horizontal and vertical headers. Otherwise, this should do the job
stylesheet = "QHeaderView::section{Background-color:rgb(190,1,1);
border-radius:14px;}"
Table.setStyleSheet(stylesheet)
这篇关于PyQt QTableWidget 水平标题标签样式表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文