[SOLVED] Handle mouse press in a QGraphicsScene
Hello I am attempting to capture a mouse press in a QGraphicsScene. What I want to do is when a user presses the "Delete Room" button, the application goes into a mode so that when the mouse is clicked (for a second time after the button is pressed, think of it like a "select to delete") it just prints something to the debug.
Here is a screenshot of the application http://paste.opensuse.org/view/raw/35139719
I am pretty new to Qt so I am probably missing something here. My instinct was to use signals and slots to change the mode after a button press but I dont know how to capture the mouse within the QGraphicsScene (which is in a QGraphicsView).
Thank you for any help you can give.
You can inherit QGraphicsScene and reimplement mouse events.
Take a look to "examples":https://qt-project.org/doc/qt-5/examples-graphicsview.html . There you will find many useful solutions.
Thank you, I have it working now. For anyone who comes across it on google, I just reimplemented @void mousePressEvent(QGraphicsSceneMouseEvent *event);@