diff --git a/beeref/selection.py b/beeref/selection.py index 07763d7..1ef72a4 100644 --- a/beeref/selection.py +++ b/beeref/selection.py @@ -415,11 +415,19 @@ class MultiSelectItem(SelectableMixin, """Updates itself to fit the given selection area.""" logging.debug(f'Fit selection area to {rect}') - self.setRect(0, 0, rect.width(), rect.height()) - self.setPos(rect.topLeft()) - self.setScale(1) - self.setRotation(0) - self.setSelected(True) + + # Only update when values have changed, otherwise we end up in an + # infinite event loop sceneChange -> itemChange -> sceneChange ... + if self.width != rect.width() or self.height != rect.height(): + self.setRect(0, 0, rect.width(), rect.height()) + if self.pos() != rect.topLeft(): + self.setPos(rect.topLeft()) + if self.scale() != 1: + self.setScale(1) + if self.rotation() != 0: + self.setRotation(0) + if not self.isSelected(): + self.setSelected(True) def mousePressEvent(self, event): if (event.button() == Qt.MouseButtons.LeftButton diff --git a/tests/base.py b/tests/base.py index 47762cc..19880ad 100644 --- a/tests/base.py +++ b/tests/base.py @@ -20,7 +20,7 @@ class BeeTestCase(TestCase): inst = QtWidgets.QApplication.instance() cls.app = inst if inst else QtWidgets.QApplication([]) - @classmethod - def tearDownClass(cls): - cls.app.quit() - del cls.app + # @classmethod + # def tearDownClass(cls): + # cls.app.quit() + # del cls.app