Can anyone give me a example on using QGraphicsScene::mouseMoveEvent?
Hello,
Can anyone give me a example on using QGraphicsScene::mouseMoveEvent?
My application is
* myscene->addPixmap(QPixmap::fromImage(myimage));
* ui->graphicsView->setScene(myscene);
* ui->graphicsView->show();
For me it seems no way to get mouse event on this displayed image. I want to draw lines on this displayed image.
I also have the lines in my application.h
protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent);
Can anyone give me an example or tips? Thank you in advance!
Re: Can anyone give me a example on using QGraphicsScene::mouseMoveEvent?
Hi there!
Have a look at the diagram-scene example: http://doc.trolltech.com/latest/grap...gramscene.html
You should also consider creating a subclass of QGraphicsPixmapItem and reimplementing its mouse events instead of the scenes.
That way you would hasslefree only get the events inside the item and in item coordinates. Depends on what you want to achieve..
HIH
Johannes
Re: Can anyone give me a example on using QGraphicsScene::mouseMoveEvent?
Hi Johannes,
Thank you very much! It is very helpful tip.:)