def itemChange(self, change, value): if change == QGraphicsPathItem.ItemSelectedHasChanged: self.setZValue(self.zValue() + (1 if value else -1)) return QGraphicsPathItem.itemChange(self, change, value)
def itemChange(self, change, value): if change == QGraphicsItem.ItemSelectedHasChanged: self.setPen(QPen(Qt.red if self.isSelected() else Qt.blue, 2)) return QGraphicsPathItem.itemChange(self, change, value)