after you have added the item call setSceneRect() with QGraphicsScene::itemsBoundingRect(), then you should scroll to each item.
EDIT: It it is maybe hidden by another item? Try to "play" with the z value of the item.
after you have added the item call setSceneRect() with QGraphicsScene::itemsBoundingRect(), then you should scroll to each item.
EDIT: It it is maybe hidden by another item? Try to "play" with the z value of the item.
Thanks, Lykurg. I tried calling QGraphicsScene::itemsBoundingRect() and QGraphicsScene::sceneRect() where there is only an QGraphicsTextItem added to the scene. It turned out that the items bounding rect is much larger than the scene rect. That is why the text item is not shown on the scene.
I do not know why the default QGraphicsTextItem has such larger bounding rect. How can I make it smaller to fit within the scene rect?
Bookmarks