[Solved] Mouse wheel problem

  • Hello guys,

    I want to use mousewheel to zoom in and out in an OpenGL simulation. The problem is that when I use the following code and hit mouse wheel up or down, zoom keeps going an till I do the opposite of the move.

    So for example. If I scroll up with just 1 step, the program keeps zooming without stopping, till I hit a step with mouse wheel down on my mouse to stop it.

    Any ideas how to fix this? I want a single mouse wheel up hit to add a value to the scale ratio just once!!

    here's my code:

    void GLWidget::wheelEvent(QWheelEvent *event)
    if(event->orientation() == Qt::Vertical)
    scaleRatio += (double)(event->delta()) / 10000;

    Thanks for any efforts :)

  • Ah sorry! it was a problem in my OpenGL code!!! I just noticed it!

    I'll keep the code for future reference :-)

    Thanks for even reading this :-)

Log in to reply

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