edifice.use_hover#
- edifice.use_hover()[source]#
Hook to track mouse hovering.
Use this hook to track if the mouse is hovering over a
QtWidgetElement
.hover, on_mouse_enter, on_mouse_leave = use_hover() with VBoxView( on_mouse_enter=on_mouse_enter, on_mouse_leave=on_mouse_leave, style={"background-color": "green"} if hover else {}, ): if hover: Label(text="hovering")
The
on_mouse_enter
andon_mouse_leave
functions can be passed to more than oneQtWidgetElement
.- Returns:
bool
True if the mouse is hovering over the
QtWidgetElement
, False otherwise.
Callable[[QtGui.QMouseEvent], None]
Pass this function to the
on_mouse_enter
prop of theQtWidgetElement
Callable[[QtGui.QMouseEvent], None]
Pass this function to the
on_mouse_leave
prop of theQtWidgetElement
.
- Return type:
A tuple of three values