December 7, 2010

sleam sleam
Lab Rat
39 posts

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?

4 replies

December 7, 2010

Vass Vass
Hobby Entomologist
738 posts

try add:

  1. youGraphicsViewObject->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  2. youGraphicsViewObject->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

 Signature 


Vasiliy

December 7, 2010

sleam sleam
Lab Rat
39 posts

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

December 7, 2010

fcrochik fcrochik
Lab Rat
517 posts

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

 Signature 

Certified Specialist & Qt Ambassador Maemo, Meego, Symbian, Playbook, RaspberryPi, Desktop… Qt everywhere!

December 7, 2010

sleam sleam
Lab Rat
39 posts

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

 
  ‹‹ qt app in a shared library?      How to re-direct keyboard events from Qt to Win32 windows? ››

You must log in to post a reply. Not a member yet? Register here!