From 3a4f3cf13e4cc51f4dbf250c0880d9729c02dff1 Mon Sep 17 00:00:00 2001 From: Mika Fischer Date: Tue, 7 May 2013 10:40:37 +0200 Subject: [PATCH] Use x,y,w,h for bounding rect of NPointFaceItem if available --- sloth/items/items.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sloth/items/items.py b/sloth/items/items.py index 40f5b83..20f5de8 100644 --- a/sloth/items/items.py +++ b/sloth/items/items.py @@ -682,9 +682,12 @@ class NPointFaceItem(GroupItem): self._children.append(child) def boundingRect(self): - br = GroupItem.boundingRect(self) - offset = 0.2 * br.height() - return br.adjusted(-offset, -offset, +offset, +offset) + if 'x' in self._model_item and 'y' in self._model_item and 'w' in self._model_item and 'h' in self._model_item: + return QRectF(QPointF(self._model_item['x'], self._model_item['y']), QSizeF(self._model_item['w'], self._model_item['h'])) + else: + br = GroupItem.boundingRect(self) + offset = 0.2 * br.height() + return br.adjusted(-offset, -offset, +offset, +offset) def paint(self, painter, option, widget=None): GroupItem.paint(self, painter, option, widget)