I\'m working on program which shows user some picture that is selected by him. But there is a problem because I would like to fit this picture in QGraphicsView\'s frame and
Solution for my question is showEvent() for Dialog. This means that you can't call fitInView() before the form is showed, so you have to create showEvent() for dialog and the picture will be fitted into QGraphics View's frame.
And example code which you have to add into dialog's code:
void YourClass::showEvent(QShowEvent *) {
ui->graphicsView->fitInView(scn->sceneRect(),Qt::KeepAspectRatio);
}