My custom table model derives from QAbstractTableModel and is then displayed in a QTableView.
Looks like this:

I would like to change the text color for certain row headers, which can be decided in the model. Is it possible to color certain headers from there? I couldn’t find a way so far. What I found was about setting background/text color for all headers, not for special few. The color is supposed to be kind of markup for the user.
What you have to do is reimplement
QAbstractTableModel::headerData().Depending on the value of section (header index starting at zero) you can individually style the header items.
The relevant values for foreground (=text color) and background in Qt::ItemDataRole are
Qt::BackgroundRoleandQt::ForegrondRoleE.g. like this: