Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Disable scrolling in QGraphicsView



  • Hi, I got an application where I use the mouse wheel to zoom in and out (scale) the contents of the QGraphicsView.
    But when the QGraphicsView's sceneRect is smaller than the scene, I get scrollbars, and the scene is scrolled to the edge before any QWheelEvent's are passed to my QMainWindow.

    How can i solve this?



  • try add:
    @
    youGraphicsViewObject->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    youGraphicsViewObject->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    @



  • thank you, but that only makes the scrollbars invisible, the view still scrolls.



  • just a guess: isn't it because of the overshoot (I think that is how it is called)?



  • yes, it is because of the overshoot, but I always have overshoot..


Log in to reply