pyqt add rectangle in Qgraphicsscene
问题 I have a scene like this class Scene(QtWidgets.QGraphicsScene): def __init__(self, parent=None): super(Scene, self).__init__(parent) def mousePressEvent(self, event): print('scene pressed') self.wid = MyRect(event.pos(), event.pos()) self.addItem(self.wid) self.wid.show() I would like class MyRect(QtWidgets.QGraphicsRectItem) with painter, mouse event and so on to be a draggable rectangle. all stuff in MyRect So then I could have many Rectangle to the scene and even after draw line between