Hey wysota,,,, he cud also use QGraphicsScene::itemsBoundingRect instead of calculating the united on boiunding rects himself , isnt it ???
Hey wysota,,,, he cud also use QGraphicsScene::itemsBoundingRect instead of calculating the united on boiunding rects himself , isnt it ???
Yes, of course. It could be a bit slower though, but unless there are many many items in the scene, it shouldn't matter.
Thanks, It's works =)
I used
Qt Code:
scene->setSceneRect(0, 0, scene->itemsBoundingRect().width() + offset, scene->itemsBoundingRect().height() + offset);To copy to clipboard, switch view to plain text mode
It's slow, but I don't know other way![]()
As I mentioned before, cache the result from a previous call and update it when an item is moved (based on the move itself).
Prefer this:
Qt Code:
scene->setSceneRect(scene->itemsBoundingRect());To copy to clipboard, switch view to plain text mode
The itemsBoundingRect() function finds the actual bounding rect, and that might not be at (0, 0). If you force the scene rect to be (0, 0, width, height), you're bound to have items outside the scene.
Bitto / Andreas Aardal Hanssen - andreas dot aardal dot hanssen at nokia
Nokia Software Manager, Qt Development
Bookmarks