View Full Version : Using QGraphicsSceneMouseEvent

11th April 2008, 02:35
i would like to use the QGraphicsSceneMouseEvent for My application To get The coordinate of the mouse at The GraphicsView ( which contains the GraphicsScene)..

I tried t create my own Class scene that inherit from QGraphicScene to implement the virtual mouse methods ..

void midoscene::mousePressEvent(QGraphicsSceneMouseEven t *e){

point+=e->scenePos(); //QPointF point(0,0)

but the problem is that i should write the coordinate of mouse on a label in the mainWidget tht contain the scene ..

please if someone could show how to use that methode to return the mouse coordinates ..

thanks !!!

11th April 2008, 07:01
emit a custom signal and connect it to a slot in the label or elsewhere (depending on the signature).

11th April 2008, 19:46
Or you can install a filter on mainwindow and convert the mouse cordinates to scene cordinates and display them status bar or whereever u want.