PDA

View Full Version : fitInView problem at QGraphicsView



oguzy
20th November 2008, 07:54
At my qt4 application i am creating a QGraphicsView and adding a scene to it then displaying pdf files, when i rotate the view i want to image fit in the view so i tried to use the finInView but couldn't managed to fit the view seems something is missing, can someone help me on it? Here is the class: http://rafb.net/p/Kgkr7116.html

You may read the line 33,34, 73 and then display and paintView functions. Do i need to set a rect for the scene?

The problem is when i rotate the graphicsview, i am not sure how to fit the image at the view. If i don't make any scaling, it fits but there always happen extra empty spaces to scroll.

nicolas1
20th November 2008, 23:36
take scene bounding rect of graphics item and call



centerOn(rect.center());

setSceneRect(rect);