Example #1
0
 def paint(self, painter: QPainter, option: QStyleOptionViewItem,
           index: QModelIndex):
     # Draw the item regularly first, and then redraw it as if it was not
     # selected. That way, we get the selection highlight, but it does
     # not affect the color of the decoration.
     super().paint(painter, option, index)
     option.state = option.state & ~QStyle.State_Selected
     super().paint(painter, option, index)
Example #2
0
 def paint(self, painter: QtGui.QPainter,
           option: QtWidgets.QStyleOptionViewItem, index):
     if option.state & QtWidgets.QStyle.State_HasFocus:
         option.state = option.state ^ QtWidgets.QStyle.State_HasFocus
     super().paint(painter, option, index)