[Qt 4.8] Capturing mouse wheel
-
I have a custom Qt widget that displays some 3D content. The user can rotate the display with the left button and zoom with the wheel.
I am responding to left drag with mousePress, mouseMove, and mouseRelease event handlers. I am responding to the wheel with a wheel event handler.
While dragging the left button works fine, and the widget captures the mouse and continues to receive events from outside of its area as long as the button is held down, I would like to also capture mouse wheel events as long as the left button is down.
The reason I want to do this is because sometimes the user is rotating and zooming at the same time. The behavior here is that they will press the left button, drag, use the wheel while dragging the left button, then release the left button. The problem is that the wheel events are not "captured", and so if the user is rotating the display and moves the mouse outside of the widget's client area, but is using the wheel at the same time, the wheel events are sent to whatever other widget happens to be under the pointer at that time, causing selections and such that the user does not expect.
So basically, as long as the user is dragging with the left button, I'd also like wheel events to be directed only to the widget regardless of where the mouse is on the screen.
Is there a way to have a widget grab wheel events from outside its client area while a left drag is in progress?