[solved] graphicsView Mouse position and click.
-
wrote on 23 Dec 2014, 15:07 last edited by
Hi all.
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.
-
Hi,
There's something unclear: What is your dialog doing ?
-
wrote on 24 Dec 2014, 15:31 last edited by
hi,
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 ?
-
wrote on 26 Dec 2014, 10:57 last edited by
merry christmas,
no i only have a dialog window in whith i put a graphicsView via the dialog.UI
so the files that i have are.
dialog.cpp
main.cpp
dialog.h
dialog.uiIt 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.
-
wrote on 29 Dec 2014, 09:00 last edited by
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 :)
1/8