Drawing a virtual mouse cursor


  • Qt Champions 2016

    Hello, my question is related to a previous one I asked recently. Although I've made progress with restricting the mouse cursor to a certain area, there are artifacts that bug me and I wish to fix them.

    • When the cursor is leaving the window I get a resize icon shown that I wish to avoid. Unfortunately, the resize cursor is not managed by Qt but by the window manager instead.
    • There is significant flicker at the edges, especially if the mouse movement is fast. I attribute this to the way events are handled - after the cursor changes position, Qt is notified, it creates and dispatches the mouse event, in which I'm setting the cursor position anew, to the correct coordinates - if I'm wrong please correct me. This means that I'm actually intercepting the event after the OS has handled the cursor movement and this leads to flicker.

    @Chris-Kawa has suggested that I implement a virtual cursor and intercept and dispatch the mouse events by myself. This if fine with me. The question is how to draw the virtual cursor. Is it supposed to be a widget that I'll be moving around, a pix/bitmap that I should draw directly on the screen? One other thing I was wondering about is, whether I could use the system cursor (image) in some way (I don't intend to change its appearance). Any suggestion on how to go about drawing the cursor is greatly appreciated.

    Kind regards.



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