How to get mouse events from QGraphicsView triggered from MainWindow Menu

From a QMainWindow Menu,one QGraphicsView is invoked and shown from the click event.How to pass the mousePressEvent, mouseReleaseEvent and draw on the Graphics Scene,as the View holds an Image.

Hi @Satyendra welcome to the forum!

QGraphicsView intercepts the mouse events to handle them (for object interaction).

You can subclass QGraphicsView however and override the mouse events on the subclass if you want low-level access (before graphics view has interpreted them into scene coordinates). Otherwise you can handle QGraphicsSceneMouseEvent events on the objects in the view itself.

Thanks Martin, I will try this solution and update the result.

This is Mainwindow from here, Second MainWin is triggered.
MainWin2

mainwin2 is invoked from Mainwindow like below.

   def openSecWin(self):
       self.win = QMainWindow()
       self.uiSecWin = Ui_SecWindow()
       self.uiSecWin.setupUi(self.win)
       self.win.show()

To draw a rectangular or circular region on the mainwin2,which has a Image on Graphics Scene,how to get mouse events for this window,which has a seperate QGraphicsView.Please suggest.