Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[solved] graphicsView Mouse position and click.
I am looking for a way that i can get the mouse position when clicked in a graphicsView.
i tryed in the Dialog to add the @mousePressEvent(QGraphicsSceneMouseEvent *ev);@
but that did not react to a mouse click.
but when i use @mousePressEvent(QMouseEvent *ev);@ then it works but it wil retun the mouse position from the Dialog window and not only the graphicsView.
I need some fresh ideas on how to get the X and Y from the graphicsView.
Thanx in advanced.
There's something unclear: What is your dialog doing ?
ooow jhee sorry for that.
i created a new Dialog project and then the mainwindow is changed in dialog.
so it is the mainwindow whare the graphicsView is at.
Do you mean that you open a dialog from your mainwindow ?
no i only have a dialog window in whith i put a graphicsView via the dialog.UI
so the files that i have are.
It is just a basic dialog project from QT creator.
Same to you
Then you have to subclass the QGraphicsView if you want to have that information from it or use an event filter.
Thanx a lot it helped me in the ride direction.
You're welcome !
Since you have your mouse events working correctly, please update the thread title prepending [solved] so other forum viewers may know a solution has been found :)