src/eric7/Graphics/UMLGraphicsView.py

branch
eric7
changeset 9500
5771348ded12
parent 9482
a2bc06a54d9d
child 9502
6091145e189e
equal deleted inserted replaced
9499:dd389c57c2f0 9500:5771348ded12
529 529
530 # step 2: find the index of the item to align in relation to 530 # step 2: find the index of the item to align in relation to
531 amount = None 531 amount = None
532 for i, item in enumerate(items): 532 for i, item in enumerate(items):
533 rect = item.sceneBoundingRect() 533 rect = item.sceneBoundingRect()
534 if alignment == Qt.AlignmentFlag.AlignLeft: 534 if (
535 if amount is None or rect.x() < amount: 535 alignment == Qt.AlignmentFlag.AlignLeft
536 amount = rect.x() 536 and (amount is None or rect.x() < amount)
537 index = i 537 ):
538 elif alignment == Qt.AlignmentFlag.AlignRight: 538 amount = rect.x()
539 if amount is None or rect.x() + rect.width() > amount: 539 index = i
540 amount = rect.x() + rect.width() 540 elif (
541 index = i 541 alignment == Qt.AlignmentFlag.AlignRight
542 elif alignment == Qt.AlignmentFlag.AlignHCenter: 542 and (amount is None or rect.x() + rect.width() > amount)
543 if amount is None or rect.width() > amount: 543 ):
544 amount = rect.width() 544 amount = rect.x() + rect.width()
545 index = i 545 index = i
546 elif alignment == Qt.AlignmentFlag.AlignTop: 546 elif (
547 if amount is None or rect.y() < amount: 547 alignment == Qt.AlignmentFlag.AlignHCenter
548 amount = rect.y() 548 and (amount is None or rect.width() > amount)
549 index = i 549 ):
550 elif alignment == Qt.AlignmentFlag.AlignBottom: 550 amount = rect.width()
551 if amount is None or rect.y() + rect.height() > amount: 551 index = i
552 amount = rect.y() + rect.height() 552 elif (
553 index = i 553 alignment == Qt.AlignmentFlag.AlignTop
554 elif alignment == Qt.AlignmentFlag.AlignVCenter: 554 and (amount is None or rect.y() < amount)
555 # __IGNORE_WARNING_Y102__ 555 ):
556 if amount is None or rect.height() > amount: 556 amount = rect.y()
557 amount = rect.height() 557 index = i
558 index = i 558 elif (
559 alignment == Qt.AlignmentFlag.AlignBottom
560 and (amount is None or rect.y() + rect.height() > amount)
561 ):
562 amount = rect.y() + rect.height()
563 index = i
564 elif (
565 alignment == Qt.AlignmentFlag.AlignVCenter
566 and (amount is None or rect.height() > amount)
567 ):
568 amount = rect.height()
569 index = i
559 rect = items[index].sceneBoundingRect() 570 rect = items[index].sceneBoundingRect()
560 571
561 # step 3: move the other items 572 # step 3: move the other items
562 for i, item in enumerate(items): 573 for i, item in enumerate(items):
563 if i == index: 574 if i == index:

eric ide

mercurial