code: def paint(self, painter, option, index):
          
  
          icon_rect = QtCore.QRectF(option.rect).adjusted(3, 3, -3, -3)
          icon_rect.setWidth(14)
          icon_rect.setHeight(14)
  
          icon_color = colors["idle"]
          icon = icons[index.data(model.Type)]
  
          if index.data(model.Type) == "record":
              icon_color = record_colors[index.data(model.LogLevel)]
  
          elif index.data(model.Type) == "error":
              icon_color = colors["warning"]
  
          metrics = painter.fontMetrics()
  
          label_rect = QtCore.QRectF(option.rect.adjusted(
              icon_rect.width() + 12, 2, 0, -2))
  
          assert label_rect.width() > 0
  
          label = index.data(model.Label)
          label = metrics.elidedText(label,
                                     QtCore.Qt.ElideRight,
                                     label_rect.width() - 20)
  
          font_color = colors["idle"]
  
          hover = QtGui.QPainterPath()
          hover.addRect(QtCore.QRectF(option.rect).adjusted(0, 0, -1, -1))
  
          # Maintain reference to state, so we can restore it once we're done
          painter.save()
  
          # Draw label
          painter.setFont(fonts["h4"])
          painter.setPen(QtGui.QPen(font_color))
          painter.drawText(label_rect, label)
  
          # Draw icon
          painter.setFont(fonts["smallAwesome"])
          painter.setPen(QtGui.QPen(icon_color))
          painter.drawText(icon_rect, QtCore.Qt.AlignCenter, icon)
  
          if option.state & QtWidgets.QStyle.State_MouseOver:
              painter.fillPath(hover, colors["hover"])
  
          if option.state & QtWidgets.QStyle.State_Selected:
              painter.fillPath(hover, colors["selected"])
  
          # Ok, we're done, tidy up.
          painter.restore()
docs: Paint text