[Interest] QGraphicsScene mouse move event

Tony Rietwyk tony at rightsoft.com.au
Thu Mar 15 17:26:00 CET 2012


Hi Marc, 

Have a look at QWidget.setMouseTracking. 

Tony.


> Sent: Friday, 16 March 2012 2:52 AM
> 
> Hi,
> 
> Quick question about QGraphicsScene::mouseMoveEvent(...):
> 
> I only receive a mouse move event when the left mouse button is pressed.
> For example, this code:
> 
> void MyScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
>    qDebug() << "Scene mouse move event";
>    if (!something)
>    {
>       QGraphicsScene::mouseMoveEvent(event);
>       return;
>    }
> 
>    // Do somehting each time the mouse moves over the scene rect.
> }
> 
> prints "Scene mouse move event" only when I press the left mouse button
> and move the mouse.
> 
> Is this normal behavior? Should I reimplement the mouseMoveEvent from
> QGraphicsView instead? This is kinda strange...
> 
> Regards,
> 
> Marc





More information about the Interest mailing list