C++ 如何更改QTableWidget的背景色';s垂直标题?
我想更改C++ 如何更改QTableWidget的背景色';s垂直标题?,c++,qt,qtablewidget,qtstylesheets,C++,Qt,Qtablewidget,Qtstylesheets,我想更改QTableWidget的颜色。我几乎得到了我喜欢的结果,但垂直标题中有两个区域保持白色: 在写这篇文章之前,我实际上还设法给左上角涂上了颜色,但没有给其他区域涂上颜色。以下是我正在使用的样式表: QTableCornerButton::section { background-color: #8b8d8e; } QHeaderView::section { color: white; background-color: #747678; gridli
QTableWidget
的颜色。我几乎得到了我喜欢的结果,但垂直标题中有两个区域保持白色:
在写这篇文章之前,我实际上还设法给左上角涂上了颜色,但没有给其他区域涂上颜色。以下是我正在使用的样式表:
QTableCornerButton::section {
background-color: #8b8d8e;
}
QHeaderView::section {
color: white;
background-color: #747678;
gridline-color: #747678;
}
最后我自己找到了答案:
/*The top-left area is actually a button:*/
QTableCornerButton::section {
background-color: #8b8d8e;
}
我发布的原始css(QHeaderView::section)只引用头条目,而不是头本身
/*The lower part of the vertical header:*/
QHeaderView {
background-color: #8b8d8e;
}