View Full Version : QWheelEvent: checking if wheel has stopped

30th September 2011, 00:57
I have a QWheelEvent and I use it to zoom a QGLWidget scene in and out. Is it possible to intercept when the mouse wheel has stopped, something similar to mouseReleaseEvent(QMouseEvent *event) ?


30th September 2011, 06:59
The wheel will have stopped when you stop receiving wheel events. Just run a timer that is reset in every wheel event and when it times out, you'll know the user stopped scrolling.

30th September 2011, 11:37
Thanks wysota, I have difficulties understanding this.

Shall I actually timer->start(0) in my main loop, and call again timer->start(0) in the wheelevent routine to restart the timer again?

30th September 2011, 14:00
No, zero timeout timer is not correct. Set the timeout to something like 500ms (or less if you want the mechanism to be more responsive at the cost of having some false positives).

30th September 2011, 14:03
Thanks wysota, infact now it's working perfectly!