Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, December 2007
QT 4.4 enter/leave events


Message 1 in thread

Hey there,

I'm using the latest Qt 4.4 snapshot.
I have a widgets with enter and leave event implementations.

When I get an enter event I'm highlighting the widget.

On some very specific cases the enter / leave event is not called.

For example when deleting a widget and the cursor goes directly inside the 
next one.

Is there a more reliable way to detect if the cursor is in or out the 
widget?

Thanks. 

--
 [ signature omitted ] 

Message 2 in thread

Hi Benjamin,

> I'm using the latest Qt 4.4 snapshot.
> I have a widgets with enter and leave event implementations.
> 
> When I get an enter event I'm highlighting the widget.
> 
> On some very specific cases the enter / leave event is not called.
> 
> For example when deleting a widget and the cursor goes directly inside the 
> next one.

This is a known issue that will be fixed before the final Qt 4.4 release.

> Is there a more reliable way to detect if the cursor is in or out the 
> widget?

With few exceptions you will get enter/leave events when the cursor 
moves in/out of a widget. Exceptions are when there is:

1) a mouse grabber (QWidget::grabMouse is called).
2) a mouse button pressed.
3) a modal dialog.
4) an active popup.

The Qt::WA_UnderMouse attribute is set on the entered widget.

As I said, enter/leave events doesn't quite work how it's suppose to 
work at the moment, but we will look into it.

-- 
 [ signature omitted ] 

Message 3 in thread

On Dec 7, 2007, at 7:07 AM, Benjamin Arnow wrote:

> When I get an enter event I'm highlighting the widget.
>
> On some very specific cases the enter / leave event is not called.
>
> For example when deleting a widget and the cursor goes directly  
> inside the next one.
>
> Is there a more reliable way to detect if the cursor is in or out  
> the widget?

I use the events for much of the same purpose, and I too noticed this  
problem, though with 4.2.3. However, my fix was to simply handle the  
exceptional cases and recheck the cursor position since they are few  
and there was already some activity that was taking place when I  
would have expected an enter/leave sequence.

Brad

-- 
 [ signature omitted ]