[solved] QGraphicsView::fitInView margins ?
-
Why this:
@graphics_view->fitInView(scene->sceneRect(), Qt::KeepAspectRatio);@
doesn't work as expected ? It is showing margins around the scene size.
Thanks !
-
Hi,
just an educated guess, but since you want to keep the original aspect ratio, you'll end up with margins in order for the scene to fit completely in the view while retaining the aspect ratio (think of a 16:9 movie looked on a 4:3 screen)
-
These margins I'm expecting, but the margins I'm seeing now isn't from the aspect ratio, even if I change the aspect ratio mode the problem still continues.
-
Do you have a minimal example that reproduce the problem ?
-
Thanks for reply SGalst, I actually have figured out what the problem was, it is described here (http://stackoverflow.com/questions/17028680/qt5-c-qgraphicsview-images-dont-fit-view-frame).
Now I'm facing another problem with QGraphicsView, looks like an endless road hehe (http://qt-project.org/forums/viewthread/34216/). Thanks !
-
You're welcome !
What you could also do is put that in the resize event of your container widget.
Don't forget to update the thread title prepending [solved] so other forum users may know that a solution has been found :)