Search code examples
qtscaleqgraphicsviewqgraphicsscene

QGraphicsView not zooming in


I am using Qt 5.7 and have a QGraphicsView in which I have added a QSceneView. At the program start, I fit the scene into the view with fitinview and Qt::IgnoreAspectRatio (maybe this is relevant?). I am trying to create an interface for zooming in and out with 4 simple buttons. To zoom out horizontally for example I call view.scale(0.5,1).

However, if I try to zoom on in any axis by using scale factors larger than 1, nothing happens. It's as if I didn't even click the button, as no matter how often I pressed zoomed in, I can zoom out with one click. Somehow the scale method is being completely ignored if the value is greater than 1.


Solution

  • The Problem was using fitinview and Qt::IgnoreAspectRatio. I removed the call and everything works perfectly now.