- QMenu menu;
- QAction* removeAction = menu.addAction("Remove");
- QAction * selectedAction= menu.exec(event->screenPos());
+ /* 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
+ */
+ bool canRemove = true;
+ InterfaceItem* groupIfaceItem = NULL;
+ if (fromInterfaceItem->getOwner()->isGroupItem()) {
+ groupIfaceItem = fromInterfaceItem;
+ }
+ else if (toInterfaceItem->getOwner()->isGroupItem()) {
+ groupIfaceItem = toInterfaceItem;
+ }
+
+ if (groupIfaceItem != NULL) {
+ ConnectedInterface* ref = groupIfaceItem->refInter;
+ if ((ref->isConnectedFrom()) && (ref->isConnectedTo())) {
+ canRemove = false;
+ }
+ }