Hover Enter of Widget Moved Under Mouse
-
Is there a way to determine when a widget is moved under the mouse cursor? Typically, a HoverEnter is sent when the cursor is moved over a widget but in the opposite case where the widget is moved under the cursor there's no HoverEnter event. A polling timer is the only fix I can think of, but attaching a timer to every widget doesn't seem like the greatest idea.
Edit: I noticed Qt uses childAt(QPoint) when determining which widget to give the HoverEnter event to when the mouse enters the window, so maybe the next best question would be is there a way to determine when an arbitrary widget has moved? Aside from installing a huge amount of event filters for Move events there doesn't seem to be a way to track a particular widget's movement because Move events are only sent if a widget is moved inside of its parent, so 'global' moves (e.g., the window moved) aren't considered moves.
-
Hi,
What is the goal of detecting that the widget under the mouse cursor moved by itself ?
How would they be moved ? -
The goal is to have the hover style applied correctly regardless of how the widget wound up under the mouse. One example for how the widgets get moved is the window being maximized then restored. If the window is restored and the widget is moved under the mouse as a result of the restore, the hover style isn't applied.
The HoverLeave event has the inverse of the issue, where if the widget is moved away it doesn't receive a HoverLeave event. This is mostly an issue with my custom title bar, where if I maximize then restore the TitleBar, the maximize button never receives a HoverLeave event and so displays the hover style when the window is restored and the maximize button is shown.
Edit: The HoverEnter seems to function correctly when the window is restored, but the HoverLeave event still has the issue. A better example for the HoverEnter event may be a dynamic layout, where a widget is removed resulting in a different widget moving under the mouse.