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. Capturing mouse events of container (bottom) widget?
Forum Updated to NodeBB v4.3 + New Features

Capturing mouse events of container (bottom) widget?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 682 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
    #1

    What I'm trying to accomplish is always have the current mouse position relative to the window's top left corner. I could maybe poll for the cursor's position every n milliseconds, but I would rather react to the mouse move events as they're created/sent.

    For now, I have a frameless window (the container) that I want to catch the mouse move events of, the problem is that the top-level widgets in it's layout are the only things receiving the events. I tried setting mouse tracking on the container and filtering the application's events from the container, but it still only receives them when a mouse button is held down.

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

      Hi,

      You should then consider using an event filter that you set on all widgets contained in your container widget.

      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
      1
      • Q Offline
        Q Offline
        Qt_User72653
        wrote on last edited by
        #3

        Thanks.

        I did wind up going with polling the cursor position, but I might look into implementing your solution in the future.

        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