From 5eecfd6789d957e7fa582ea8e1f0d3308b4fb80a Mon Sep 17 00:00:00 2001 From: Mika Fischer Date: Fri, 27 Jan 2012 14:00:06 +0100 Subject: [PATCH] Try to fix boundingRect of GroupItem by ignoring boundingRect of text child --- sloth/items/items.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sloth/items/items.py b/sloth/items/items.py index a727d98..d04e905 100644 --- a/sloth/items/items.py +++ b/sloth/items/items.py @@ -433,7 +433,12 @@ class GroupItem(BaseItem): BaseItem.setColor(self, *args, **kwargs) def boundingRect(self): - return self.childrenBoundingRect() + br = QRectF() + for item in self.childItems(): + if item is self._text_item: + continue + br |= item.mapRectToParent(item.boundingRect()) + return br class OccludablePointItem(PointItem): @@ -536,7 +541,7 @@ class NPointFaceItem(GroupItem): self._children.append(child) def boundingRect(self): - br = self.childrenBoundingRect() + br = GroupItem.boundingRect(self) offset = 0.2 * br.height() return br.adjusted(-offset, -offset, +offset, +offset)