X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/df84660fd98b39737692d57b68c8b2c2d34af0f1..4cf57e6db08da791233d75237f62e74bc88dd427:/ConnectionItem.cpp?ds=sidebyside diff --git a/ConnectionItem.cpp b/ConnectionItem.cpp index 5dcd338..4de86cb 100644 --- a/ConnectionItem.cpp +++ b/ConnectionItem.cpp @@ -876,18 +876,22 @@ void ConnectionItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) { /* have to check if the connection can be removed. If the from or to InterfaceItem is owned by a group item, and this item is both connected to and from, thus it is impossible to remove this connection + because there would be a group interface alone and not connected and this situation is not allowed. + + Nevertheless, there are 2 exceptions : + - a from group interface is connected to more than one input interface + - the connection is between a source block outside the top group and the top group */ bool canRemove = true; - InterfaceItem* groupIfaceItem = NULL; + if (fromInterfaceItem->getOwner()->isGroupItem()) { - groupIfaceItem = fromInterfaceItem; - } - else if (toInterfaceItem->getOwner()->isGroupItem()) { - groupIfaceItem = toInterfaceItem; + ConnectedInterface* ref = fromInterfaceItem->refInter; + if ((ref->isConnectedFrom()) && (ref->getConnectedTo().length() == 1)) { + canRemove = false; + } } - - if (groupIfaceItem != NULL) { - ConnectedInterface* ref = groupIfaceItem->refInter; + else if ((toInterfaceItem->getOwner()->isGroupItem()) && (! toInterfaceItem->getOwner()->getRefBlock()->isTopGroupBlock())) { + ConnectedInterface* ref = toInterfaceItem->refInter; if ((ref->isConnectedFrom()) && (ref->isConnectedTo())) { canRemove = false; }