Any easy way for mouse events to continue past the edge?



  • I have a qglWidget with a lot of stuff rendering inside and it gets a bit annoying dragging some of my 3d models around only to have the mouse stop at the edge of the screen - I was just wondering if anybody knows a way to keep the mouse coordinates in QMouseEvens increasing after you get to the edge of the screen.



  • What I do is that I install an event filter on the application, and enable mouse tracking. That gives a continuous flow of mouse events as long as the mouse is within your applications borders. If you also need the events when the mouse is outside your application, you'll need another approach, such as a transparent widget overlaying your entire screen, polling the mouse position or use platform specific mouse tracking methods.



  • Just to clarify things: "Edge of the screen" vs. "edge of my widget" vs. "edge of my application window".

    If you really meant "edge of the screen" (aka display monitor, desktop), I believe you are out of luck.

    If you mean "edge of my widget" or "edge of my application window", it should be enough to make yourself the mouse grabber.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.