'Override the QStyledItemDelegate paint function.
Args:
painter: QPainter * painter
option: const QStyleOptionViewItem & option
index: const QModelIndex & index'

def paint(self, painter, option, index):

    self._painter = painter
    self._painter.save()
    self._opt = QStyleOptionViewItem(option)
    self.initStyleOption(self._opt, index)
    self._style = self._opt.widget.style()
    self._draw_background()
    self._draw_icon()
    self._draw_text(index)
    self._draw_focus_rect()
    self._painter.restore()
