Using QStyledItemDelegate on a QTableView

Most databases store dates in the format YYYY-MM-DD. When using a QTableView to display a database table in PyQt it’s useful to be able to display this in a different format. Being from the UK I’d rather have the date displayed in the UK style – DD/MM/YYYY. This is where QStyledItemDelegate comes in.

I’d put off looking into this for a while because whenever I tried to look in to using QStyledItemDelegate I saw people mentioning paint methods. I know nothing about painting in PyQt and get quite scared when I see it mentioned. I really need to get over that.

Not to worry though, because it’s not needed…

more ...