I am using `QGraphicsView` to show something like function graphs. `QGraphicsView` keeps its transformation during resize, so the visible portion of the scene changes.

I need to keep the view exactly the same during resize - aspect ratio don't have to be kept since I allow independent scaling on X and Y axes.

This does not work:

```
void resizeEvent(QResizeEvent *event) override
{
    QRectF rect = mapToScene(this->viewport()->rect()).boundingRect();
    QGraphicsView::resizeEvent(event);
    fitInView(rect);
}

```

Problem is in getting the proper view rectangle. This solution zooms out on resize.

Is there some simple way to achieve this?