0
如何將QLinearGradient()
添加到Qrect()
。我只能添加固體顏色Qt.black
等。示例代碼:向QGraphicsItem添加漸變坡度[PySide]
class ItemClass(QGraphicsItem):
def __init__()
super(ItemClass, self).__init__()
#
def boundingRect(self):
return QRectF(x, y, w, h)
def paint(self, painter, opt, w):
rec = self.boundingRect()
painter.fillRect(rec, #Here I need gradient ramp)