如何改变QTableWidget vertical header的背景颜色?

How to change the background color of the QTableWidget's vertical header?

我想更改 QTableWidget 的颜色。我几乎得到了我喜欢的结果,但是垂直 header 中的两个区域仍然是白色的:

在写这篇文章之前post我实际上也设法给左上角上色了,但没有给其他区域上色。这是我正在使用的样式表:

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;
}
/*The lower part of the vertical header:*/
QHeaderView {
    background-color: #8b8d8e;
}

我发布的原始 css (QHeaderView::section) 仅引用了 header 条目,而不是 header 本身。