X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/d30c9cf675ad7141d1c8e31d2e72315267d45cf2..f311fbc3e1436bf248c54225f0743cfa671c4bd7:/GroupItem.cpp?ds=inline diff --git a/GroupItem.cpp b/GroupItem.cpp index bb26e53..fa341b2 100644 --- a/GroupItem.cpp +++ b/GroupItem.cpp @@ -9,6 +9,7 @@ #include "AbstractInterface.h" #include "ConnectedInterface.h" #include "GroupScene.h" +#include "ParametersWindow.h" GroupItem::GroupItem(BoxItem *_parentItem, @@ -17,6 +18,9 @@ GroupItem::GroupItem(BoxItem *_parentItem, Parameters *_params) throw(Exception) :AbstractBoxItem( _refBlock, _dispatcher, _params) { parentItem = _parentItem; + if (parentItem != NULL) { + parentItem->setChildGroupItem(this); + } /* minimumBoxWidth = nameWidth+2*nameMargin; @@ -337,7 +341,7 @@ void GroupItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { int mode = getScene()->getEditionMode(); - dispatcher->setCurrentGroupWidget(getScene()->getGroupWindow()); + dispatcher->setCurrentGroupWidget(getScene()->getGroupWidget()); /* NOTE : commneted because group interface are normally created and the connected directly to a block within @@ -500,12 +504,19 @@ void GroupItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { void GroupItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { QMenu menu; + QAction* titleAction = NULL; QAction* showProperties = NULL; QAction* removeAction = NULL; QAction* renameAction = NULL; + QAction* showParameters = NULL; InterfaceItem* ifaceItem = getInterfaceFromCursor(event->pos().x(), event->pos().y()); - if( ifaceItem != NULL){ + + // menu for interface + if( ifaceItem != NULL) { + titleAction = menu.addAction("Interface operations"); + titleAction->setEnabled(false); + menu.addSeparator(); showProperties = menu.addAction("Show properties"); renameAction = menu.addAction("Rename"); menu.addSeparator(); @@ -520,6 +531,13 @@ void GroupItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { } } else { + titleAction = menu.addAction("Block operations"); + titleAction->setEnabled(false); + menu.addSeparator(); + + if (refBlock->nbParameters() > 0) { + showParameters = menu.addAction("Show parameters"); + } renameAction = menu.addAction("Rename"); } QAction* selectedAction = menu.exec(event->screenPos()); @@ -528,16 +546,19 @@ void GroupItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { if(selectedAction == renameAction){ if(ifaceItem != NULL) - dispatcher->rename(ifaceItem); + dispatcher->renameInterface(ifaceItem); else - dispatcher->rename(this); + dispatcher->renameBlockOrGroup(this); } else if(selectedAction == showProperties){ dispatcher->showProperties(ifaceItem); - } + } else if (selectedAction == removeAction) { dispatcher->removeGroupInterface(ifaceItem); } + else if(selectedAction == showParameters) { + new ParametersWindow(refBlock, params, NULL); + } } InterfaceItem* GroupItem::isHoverInterface(QPointF point) {