[Qt-interest] How to get mouse cursor position from QEvent

Dan Milburn danmilburn at clara.co.uk
Mon Feb 22 18:29:13 CET 2010


Ulf-Alexander v. Ceumern-Lindenstjerna wrote:
> Hi.
> 
> I was just about to suggest casting the event to a QMouseEvent, when I
> saw that QWidget::enterEvent ( QEvent * event ) receives a plain
> "QEvent". Kind of strange, since this is an event triggered by mouse
> interaction. Is there a reason for it that I can't see?
> 

I think for most purposes, knowing the position of the mouse only as it 
enters your widget isn't very useful.

If you want to be notified as the mouse is moved over a widget, you 
would set mouse tracking on it and handle the resulting mouse move events.

Dan



More information about the Qt-interest-old mailing list