示例#1
0
    def __init__(self, parent=None):
        super(CellDelegate, self).__init__(parent)
        pal = self.parent().palette()
        col = pal.color(QtGui.QPalette.Active, QtGui.QPalette.Button)
        self.pen = QtGui.QPen(col)
        self.stale_color = QtGui.QColor("orange")
        self.stale_pen = QtGui.QPen(self.stale_color)
        self.stale_pen.setWidth(2)
        self.pen.setCosmetic(True)
        self.stale_pen.setCosmetic(True)

        self.path = QtGui.QPainterPath()
        self.path.moveTo(0, 0)
        self.path.cubicTo(0.6, 0, -0.2, 0.5, 1, 0.5)
        self.path.cubicTo(-0.2, 0.5, 0.6, 1, 0, 1)

        highlight_color = pal.color(QtGui.QPalette.Highlight)
        base_color = pal.color(QtGui.QPalette.Base)
        c1 = interp_color(highlight_color, base_color, 0.3)
        c2 = interp_color(highlight_color, base_color, 0.8)

        grad = QtGui.QLinearGradient(0, 1, 0, 0)
        grad.setCoordinateMode(QtGui.QGradient.ObjectBoundingMode)
        grad.setColorAt(0, c1)
        grad.setColorAt(0.95, c2)
        grad.setColorAt(1, c1)
        self.highlight_brush = QtGui.QBrush(grad)
示例#2
0
    def __init__(self, parent=None):
        super(CellDelegate, self).__init__(parent)
        pal = self.parent().palette()
        col = pal.color(QtGui.QPalette.Active, QtGui.QPalette.Button)
        self.pen = QtGui.QPen(col)
        self.stale_color = QtGui.QColor("orange")
        self.stale_pen = QtGui.QPen(self.stale_color)
        self.stale_pen.setWidth(2)
        self.pen.setCosmetic(True)
        self.stale_pen.setCosmetic(True)

        self.path = QtGui.QPainterPath()
        self.path.moveTo(0, 0)
        self.path.cubicTo(0.6, 0, -0.2, 0.5, 1, 0.5)
        self.path.cubicTo(-0.2, 0.5, 0.6, 1, 0, 1)

        highlight_color = pal.color(QtGui.QPalette.Highlight)
        base_color = pal.color(QtGui.QPalette.Base)
        c1 = interp_color(highlight_color, base_color, 0.3)
        c2 = interp_color(highlight_color, base_color, 0.8)

        grad = QtGui.QLinearGradient(0, 1, 0, 0)
        grad.setCoordinateMode(QtGui.QGradient.ObjectBoundingMode)
        grad.setColorAt(0, c1)
        grad.setColorAt(0.95, c2)
        grad.setColorAt(1, c1)
        self.highlight_brush = QtGui.QBrush(grad)