View Full Version : Subclassed QLabel and enterEvent

28th August 2006, 23:17

I have subclassed a QLabel and want reimplemente QWidget::enterEvent ( QEvent * event ). So the Doku says:

This event handler can be reimplemented in a subclass to receive widget enter events which are passed in the event parameter.
An event is sent to the widget when the mouse cursor enters the widget.

I ask me now, which other action, then a mouse-cursor-in, could appear in a subclassed QLabel, that starts an enterEvent()? Because, if there is only a mouse-cursor-in possible, I don't need to check this in my reimplemented function.


29th August 2006, 01:54
I don't quite understand... Check what? What triggered the event? Only a cursor entry can trigger it, if the docs say so (though of course it doesn't have to be a mouse cursor, it'll work with a touchscreen or any other input device able to move the pointer).

29th August 2006, 07:44
Ah, I read an "also" in doc (An event is sent to the widget also when the mouse cursor enters the widget.), and so I wonder which user-action can also trigger the event.
I also wonder, if only a mouse entry can trigger it, why you need QEvent * event. But as I see now, you can get the position via "event", if someone needs.