[Qt-interest] QGraphicsScene: get bounding box of selected items?
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Tue Dec 28 10:29:15 CET 2010
On 2010-12-27 Alex Malyushytsky, Alex wrote:
>>> Off course I can iterate over all rects
>
> AFAIK that what you should do.
>
> If you have to do it often you could add cashing:
Thanks for the suggestions! In my case this operation is very cheap (only a few objects, not even a dozen or so) and only executed when the user "exports" the scene to a PNG image. I need this functionality to export only the selected graphic items, and only render the bounding box of those selected items (otherwise the entire scene is rendered).
> It might be possible that some private implementation of
> QGraphicsScene already has such value cashed, but I would not rely on
> the private implementation, not counting that it is not normally accessible.
Maybe I will suggest such a public convenience method in JIRA. But for my usage the iteration over the selected items and calculate the bounding box will do for now.
Thanks and a Happy New Year,
Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list