I need to get the bounding box (in scene space) of QGraphicsItem
s that have the QGraphicsItem::ItemIgnoresTransformations
flag set.
According to the docs, you need to use QGraphicsItem::deviceTransform() to do that. I tried this:
// Get the viewport => scene transform
vp_trans = view.viewportTransform();
// Get the item => viewport transform
trans = item.deviceTransform(vp_trans);
// Get the item's bounding box in item's space
bbox = item.boundingRect();
// Map it to viewport space
bbox = trans.mapRect(bbox);
// Map it back to scene's space
bbox = vp_trans.mapRect(bbox);
But something is wrong, the bounding boxes appear smaller and far to the right of the items...