Not necessarily the cause but it is usually not a good idea to override the paintEvent() method of a container.
Especially when not calling the base implementation.

If your cells really only contain a single color, my suggestion would be to set the background of the respective QTableWidgetItem instead.
http://doc.qt.io/qt-5/qtablewidgetit...#setBackground

Cheers,
_