[Qt-interest] QGraphicsScene: get bounding box of selected items?

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Mon Dec 27 10:37:55 CET 2010


Hi,

I am getting familiar with the QGraphicsScene API. Is there a method to get the bounding box of the selected items?

This exists: http://doc.qt.nokia.com/latest/qgraphicsscene.html#itemsBoundingRect

which gives me the bounding rect of /all/ items - is there an analogon/convenience method for getting the bounding rect of the /selected/ items only?


The purpose is that I want to render only the selected items into an image.

Off course I can iterate over all rects as returned by

  http://doc.qt.nokia.com/latest/qgraphicsscene.html#selectedItems

and call http://doc.qt.nokia.com/latest/qrectf.html#united on their http://doc.qt.nokia.com/latest/qgraphicsitem.html#boundingRect, but I wonder whether I overlooked some convenience method somewhere in the Qt API...

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




More information about the Qt-interest-old mailing list