[Interest] QGraphicsScene mouse move event

505 views
Skip to first unread message

Marc Ferland

unread,
Mar 15, 2012, 11:52:13 AM3/15/12
to inte...@qt-project.org
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
_______________________________________________
Interest mailing list
Inte...@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Tony Rietwyk

unread,
Mar 15, 2012, 12:26:00 PM3/15/12
to inte...@qt-project.org
Hi Marc,

Have a look at QWidget.setMouseTracking.

Tony.


> Sent: Friday, 16 March 2012 2:52 AM

Marc Ferland

unread,
Mar 15, 2012, 12:56:27 PM3/15/12
to Tony Rietwyk, inte...@qt-project.org
"Tony Rietwyk" <to...@rightsoft.com.au> writes:

> Hi Marc,
>
> Have a look at QWidget.setMouseTracking.
>

Aaaah of course!

Thanks,

Reply all
Reply to author
Forward
0 new messages