I have a QTableWidget where I would like to color individual horizontal header items based on some criterion.
What I have come up with so far:
stylesheet = "::section{Background-color:rgb(190,1,1)}"
self.ui.Table.horizontalHeader().setStyleSheet(stylesheet)
This works, however it colors all headers simultaneously without me being able to change the color of an individual header. So the next logical step would be:
self.ui.Table.horizontalHeaderItem(0).setStyleSheet(stylesheet)
This does not work, as a single header item does not support setting a stylesheet.
Finally:
self.ui.Table.horizontalHeaderItem(0).setBackgroundColor(QtCore.Qt.red)
This runs just fine without python complaining, however it does not seem to have any effect on the background color whatsoever.
I already looked at this answer, it is what sparked my first attempt. However it only deals with coloring all headers with the same color.
How can I color the headers individually?

