What is "item"?

Typically, you use fitInView() in your QGraphicView's resizeEvent() handler, and you give it the scene()->sceneRect() for the first parameters.

Calling this from anywhere else will have a one-time effect, since it won't be called after a resize unless it is in the resizeEvent handler.