我可以更改前景色,但不能更改背景色。
我已经尝试过:
for col in range(self.table.columnCount()):
item = self.table.horizontalHeaderItem(col)
item.setForeground(foreground) # foreground changes as expected
item.setBackground(foreground) # does not affect the background color
和:
self.table.horizontalHeader().setStyleSheet("color: red; background-color: blue")
如有任何建议,我们将不胜感激