PDA

View Full Version : Using QGraphicsSceneMouseEvent



peace_comp
11th April 2008, 01:35
Hi..
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 !!!

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

aamer4yu
11th April 2008, 18: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.