mirror of
https://github.com/rbreu/beeref.git
synced 2026-03-11 08:54:28 +00:00
Prevent infinite event loop for multi selection
This commit is contained in:
parent
b98e455272
commit
cc54698baa
2 changed files with 17 additions and 9 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue