Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Hover Enter of Widget Moved Under Mouse
Forum Updated to NodeBB v4.3 + New Features

Hover Enter of Widget Moved Under Mouse

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 516 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qt_User72653
    wrote on last edited by Qt_User72653
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What is the goal of detecting that the widget under the mouse cursor moved by itself ?
      How would they be moved ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        Qt_User72653
        wrote on last edited by Qt_User72653
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved