I'm writing a little GUI utility in Qt4 which uses a QGraphicsScene. One of the items tracks the mouse in the horizontal plane as you move it around, and holding down a modifier key allows you to change the item's rotation. When rotating items I'd like the mouse cursor to change to a curvy arrow (or something) and lock visually in place, so moving it affects the item but not the mouse cursor itself.
Releasing the modifier would place the (previously invisible) cursor back to it's original point: this is to prevent the item "jumping" to the mouse's new horizontal position afterwards, which is my main problem.
I've really got no idea how to implement this in Qt4 that doesn't involve doing horrible things like:
- When the modifier is pressed store the current mouse position
- Switch the cursor to a bitmap of nothing
- Somehow draw a fake cursor in the original place (!?)
- Delete the fake cursor and switch the mouse position back when done
Be very grateful if anyone can think of a better way to achieve this. I'm not too wedded to the whole fixed mouse cursor idea in the first place but it's the only way I can think to get around this one problem with a control scheme that otherwise works pretty nicely.
Edit: I tried the crap scheme I outlined above and ran into problems moving the position of the mouse programmatically. Still trying to remember where I've used a similar system before: basically it was a rotary knob. You clicked it and moved the mouse up and down, which rotated the knob. When you released the mouse button the pointer was back where you'd initially put it, on the knob.