In the referred post OP is re-implementing the paintEvent() function.

If your case if it is just to change the foreground color, you could do it using below code, make sure to remove other palette changes you might have done.

Qt Code:
  1. item->setForeground(column, QBrush(QColor(Qt::red)));
To copy to clipboard, switch view to plain text mode