I'm creating a QGis Plugin in python which has a
QGraphicsViewin which I draw and ellipse on which I want to detect if the user clicks.
I know the ellipse inherits
QGraphicsItemwhich has a
mouseReleaseEventbut I just don't know how to listen for an event.
self.scene = QGraphicsScene() //form.py ellipse = self.dock.scene.addEllipse(0, 0, 100, 100, QPen(), QBrush()) //plugin.py //now that i've got a reference to the ellipse how do I detect when someone clicks on it ?
I guess you have to override a
class MyScene(QGraphicsScene): def mouseReleaseEvent(self, event): # here you should do something with your scene if mouse button was released
then create scene with:
self.scene = MyScene()