[Qt-interest] finding "lost" images in graphicsView

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Wed Jan 26 10:57:34 CET 2011


On 2011-01-26 Mihail Mihail Naydenov wrote:

> There is sceneRect() and, of course a view rect. You can play with 
> these. You can make scene rect resize to match view's rect to simplify 
> viewing, and also test items against scene rect to prevent them form disappearing.

I can't find a concrete reference anymore, but I think I read somewhere in the Qt docs that when one explicitly sets the scene rect - let's say to 1024 x 768 - with QGraphicsScene::setSceneRect that you can't move items across that boundary (never tested though). And I am not sure what would happen with items which already fall outside of that newly set scene rect (are they automatically removed from the scene?).

By default the scene is unbounded and sceneRect() hence returns the bounding box (expensive!) of all items: "If unset, or if set to a null QRectF, sceneRect() will return the largest bounding rect of all items on the scene since the scene was created (i.e., a rectangle that grows when items are added to or moved in the scene, but never shrinks)." [http://doc.trolltech.com/4.7/qgraphicsscene.html#sceneRect-prop]

Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22




More information about the Qt-interest-old mailing list