QGraphicsItem - Bounding rect for item, and all children? [solved]
-
wrote on 5 Jun 2011, 15:24 last edited by
Simple question: I can call boundingRect to get the bouding box of a given item. Is it possible to get the bounding box of an item, and all its children, without writing extra methods? is there some built in method? Thanks.
-
wrote on 5 Jun 2011, 15:51 last edited by
[quote author="Qt Assistant" date="0"]QRectF QGraphicsItem::childrenBoundingRect () const
Returns the bounding rect of this item's descendants (i.e., its children, their children, etc.) in local coordinates. The rectangle will contain all descendants after they have been mapped to local coordinates. If the item has no children, this function returns an empty QRectF.
This does not include this item's own bounding rect; it only returns its descendants' accumulated bounding rect. If you need to include this item's bounding rect, you can add boundingRect() to childrenBoundingRect() using QRectF::operator|().
This function is linear in complexity; it determines the size of the returned bounding rect by iterating through all descendants.[/quote]
-
wrote on 5 Jun 2011, 15:53 last edited by
Fantastic, thanks for the tip.
-
wrote on 5 Jun 2011, 15:58 last edited by
You are welcome. Assistant contains a lot of info, you only need to find it. Please don't forget to mark thread as [solved] (by editing its title)
4/4