-3

I'm writing something using Qt Widgets (C++). I need to detect when mouse is moved (either outside or inside the application window) and update cursor coordinates on my app window. I can't find any way to do it. I wonder if it's possible to use connect( ... ) statement.

Target is Win10.

sudo_woodo
  • 63
  • 9

1 Answers1

0

I figured out the best way to do it is using WinAPI through the WH_MOUSE_LL hook, as it seems Qt can only manage mouse events related to its own app.

I did it this way:

SetWindowsHookEx( WH_MOUSE_LL, doSomethingWhenMouseMoves, NULL, 0 );

More info: https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms644986(v=vs.85)

sudo_woodo
  • 63
  • 9