def paint(self, painter, option, index):
painter.fillRect(option.rect, index.data(QtCore.Qt.BackgroundRole))
super(CorrelationTableDisplay.BackgroundDelegate, self).paint(painter, option, index)
if option.state & QtGui.QStyle.State_Selected:
painter.save()
# Pointer to green
pen = QtGui.QPen(QtCore.Qt.darkGreen, 2, QtCore.Qt.SolidLine, QtCore.Qt.SquareCap, QtCore.Qt.MiterJoin)
myrect = option.rect.adjusted(0, 1, 0, 0)
painter.setPen(pen)
painter.drawLine(myrect.topLeft(), myrect.topRight())
painter.drawLine(myrect.bottomLeft(), myrect.bottomRight())
if index.column() == 0:
painter.drawLine(myrect.topLeft(), myrect.bottomLeft())
if index.column() == index.model().columnCount()-1:
painter.drawLine(option.rect.topRight() + QtCore.QPoint(0, -1), option.rect.bottomRight()+ QtCore.QPoint(0, -1))
painter.restore()
评论列表
文章目录