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
I think you should scale image. I do this and it works well:
QRect ref_Rect = QRect(x_pos, y_pos, Width, Length);
QGraphicsView* qGraph = new QGraphicsView(this);
qGraph->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
qGraph->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
qGraph->setGeometry(ref_Rect);
QGraphicsScene* scene = new QGraphicsScene(qGraph);
scene->setSceneRect(0, 0, ref_Rect.width(), ref_Rect.height());
qGraph->setScene(scene);
QImage *image = new QImage();
image->load("folder/name.png");
*image = image->scaled(ref_Rect.width(), ref_Rect.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
QGraphicsPixmapItem* item = new QGraphicsPixmapItem(QPixmap::fromImage(*image));
scene->addItem(item);
qGraph->show();