src/eric7/Graphics/UMLGraphicsView.py

branch
eric7
changeset 9500
5771348ded12
parent 9482
a2bc06a54d9d
child 9502
6091145e189e
--- a/src/eric7/Graphics/UMLGraphicsView.py	Wed Nov 09 11:32:13 2022 +0100
+++ b/src/eric7/Graphics/UMLGraphicsView.py	Wed Nov 09 15:05:06 2022 +0100
@@ -531,31 +531,42 @@
         amount = None
         for i, item in enumerate(items):
             rect = item.sceneBoundingRect()
-            if alignment == Qt.AlignmentFlag.AlignLeft:
-                if amount is None or rect.x() < amount:
-                    amount = rect.x()
-                    index = i
-            elif alignment == Qt.AlignmentFlag.AlignRight:
-                if amount is None or rect.x() + rect.width() > amount:
-                    amount = rect.x() + rect.width()
-                    index = i
-            elif alignment == Qt.AlignmentFlag.AlignHCenter:
-                if amount is None or rect.width() > amount:
-                    amount = rect.width()
-                    index = i
-            elif alignment == Qt.AlignmentFlag.AlignTop:
-                if amount is None or rect.y() < amount:
-                    amount = rect.y()
-                    index = i
-            elif alignment == Qt.AlignmentFlag.AlignBottom:
-                if amount is None or rect.y() + rect.height() > amount:
-                    amount = rect.y() + rect.height()
-                    index = i
-            elif alignment == Qt.AlignmentFlag.AlignVCenter:
-                # __IGNORE_WARNING_Y102__
-                if amount is None or rect.height() > amount:
-                    amount = rect.height()
-                    index = i
+            if (
+                alignment == Qt.AlignmentFlag.AlignLeft
+                and (amount is None or rect.x() < amount)
+            ):
+                amount = rect.x()
+                index = i
+            elif (
+                alignment == Qt.AlignmentFlag.AlignRight
+                and (amount is None or rect.x() + rect.width() > amount)
+            ):
+                amount = rect.x() + rect.width()
+                index = i
+            elif (
+                alignment == Qt.AlignmentFlag.AlignHCenter
+                and (amount is None or rect.width() > amount)
+            ):
+                amount = rect.width()
+                index = i
+            elif (
+                alignment == Qt.AlignmentFlag.AlignTop
+                and (amount is None or rect.y() < amount)
+            ):
+                amount = rect.y()
+                index = i
+            elif (
+                alignment == Qt.AlignmentFlag.AlignBottom
+                and (amount is None or rect.y() + rect.height() > amount)
+            ):
+                amount = rect.y() + rect.height()
+                index = i
+            elif (
+                alignment == Qt.AlignmentFlag.AlignVCenter
+                and (amount is None or rect.height() > amount)
+            ):
+                amount = rect.height()
+                index = i
         rect = items[index].sceneBoundingRect()
 
         # step 3: move the other items

eric ide

mercurial