开发者

How to view all items contained in QGraphicsScene?

开发者 https://www.devze.com 2023-02-27 02:51 出处:网络
is there an easy way to zoom the scene so, that all items are visible? looks like a simple task, but I\'a开发者_开发问答m sitting since an hour on it. :-(

is there an easy way to zoom the scene so, that all items are visible? looks like a simple task, but I'a开发者_开发问答m sitting since an hour on it. :-(

Many thanks in advance!


Try MyGraphicsView.fitInView(MyScene.rect()) replacing MyGraphicsView and MyScene with the correct names for your code.


Valentin, you can use QGraphicsView::scale() function to zoom the graphics view. Another way to do that is to use QGraphicsView::setTransform() method passing QTransform object with a scale tranformation

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号