X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/624231601a0f5daea9b8809993ad3503beafce4f..7b1c7e44123b9b2626205a89e27b2a4712ea30c6:/GroupScene.cpp diff --git a/GroupScene.cpp b/GroupScene.cpp index 531f62b..48de27e 100644 --- a/GroupScene.cpp +++ b/GroupScene.cpp @@ -61,6 +61,11 @@ QList GroupScene::getSelectedBlocks() { int GroupScene::setItemsId(int countInit) { int counter = countInit; groupItem->setId(counter++); + if (isTopScene()) { + foreach(SourceItem *item, sourceItems){ + item->setId(counter++); + } + } foreach(BoxItem *item, boxItems){ item->setId(counter++); } @@ -72,6 +77,13 @@ int GroupScene::setInterfacesId(int countInit) { foreach(InterfaceItem* inter, groupItem->getInterfaces()){ inter->setId(counter++); } + if (isTopScene()) { + foreach(SourceItem *item, sourceItems){ + foreach(InterfaceItem* inter, item->getInterfaces()){ + inter->setId(counter++); + } + } + } foreach(BoxItem *item, boxItems){ foreach(InterfaceItem* inter, item->getInterfaces()){ inter->setId(counter++); @@ -129,6 +141,9 @@ SourceItem *GroupScene::createSourceItem(AbstractBlock *block) { } void GroupScene::addSourceItem(SourceItem* item) { + // adding item to the scene + addItem(item); + item->setZValue(1); // add item from the QList sourceItems.append(item); } @@ -166,6 +181,13 @@ void GroupScene::addConnectionItem(ConnectionItem* item) { } void GroupScene::removeConnectionItem(ConnectionItem* item) { + + // remove connection from/to InterfaceItem + InterfaceItem* fromIfaceItem = item->getFromInterfaceItem(); + InterfaceItem* toIfaceItem = item->getToInterfaceItem(); + fromIfaceItem->removeConnectionItem(item); + toIfaceItem->removeConnectionItem(item); + // remove item from the viewport removeItem(item); // remove item from the QList