Enter and leave events in nested widget
-
Hi,
I have a widget that contains children widgets, kind of like a container. The children widgets are on top of the parent. I want to be able to catch enter/leave event such that when the mouse enters a child widget, the leave event of the parent is not called (which is the case now). The leave event should only be called once the mouse actually leaves the parent widget "zone".
Is this possible?Thanks
-
Sure it is! There are multiple mouse events to catch that will handle what you described. For every widget (subclassed) overwrite the mouseEvents and do what you need with it.
For the parent goes the same, implement the mouseEvent and handle the leave focus. -
Thanks for your reply.
How can I handle the leave focus? The problem is when I hover my mouse from inside the parent widget to one of the child widget, a leave event is triggered for the parent widget... Even though the child widget is inside the parent's boundaries!