This is useful, thanks for posting.

On the bit of reading that I've done, it's been recommended to restore the painter to its original state once you're done painting. You could call painter->save() before painting and then painter->restore() once you're done. You do do this in one particular instance, but it might be a good idea to do it for the other instances too.

Not sure what effect it actually has, but it does seem to be best practice.

QStyledItemDelegate Class Reference:
After painting, you should ensure that the painter is returned to its the state it was supplied in when this function was called. For example, it may be useful to call QPainter::save() before painting and QPainter::restore() afterwards.