[Interest] QGraphicsScene mouse move event

Marc Ferland ferlandm at sonatest.com
Thu Mar 15 16:52:13 CET 2012


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