X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/cfe8322b50c9ef08ffbc3e52b0849bca4cd1d0bf..14cd6d834ab531525a51c6a6992583b3e9143e02:/GroupScene.cpp?ds=inline diff --git a/GroupScene.cpp b/GroupScene.cpp index 7fddacd..2ceb21f 100644 --- a/GroupScene.cpp +++ b/GroupScene.cpp @@ -38,6 +38,17 @@ GroupScene::~GroupScene() { groupItem = NULL; } +/* +void GroupScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { + + //QGraphicsScene::mouseMoveEvent(event); + + QPointF p = event->scenePos(); + cout << p.x() << "," << p.y() << endl; + +} +*/ + void GroupScene::setSelectedInterface(int id, InterfaceItem* iface) { if ((id < 1)|| (id > 2)) return; selectedInterfaces[id-1] = iface; @@ -61,6 +72,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 +88,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 +152,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); } @@ -140,10 +166,11 @@ void GroupScene::removeSourceItem(SourceItem* item) { sourceItems.removeAll(item); } -void GroupScene::createConnectionItem(InterfaceItem *iface1, InterfaceItem *iface2) { +void GroupScene::createConnectionItem(InterfaceItem *iface1, InterfaceItem *iface2, bool visible) { ConnectionItem* conn = NULL; conn = new ConnectionItem(iface1,iface2, dispatcher, params); + conn->setVisible(visible); addItem(conn); addConnectionItem(conn); } @@ -196,11 +223,11 @@ void GroupScene::unselecteInterfaces() { if (selectedInterfaces[0] != NULL) { selectedInterfaces[0]->selected = false; - selectedInterfaces[0] == NULL; + selectedInterfaces[0] = NULL; } if (selectedInterfaces[1] != NULL) { selectedInterfaces[1]->selected = false; - selectedInterfaces[1] == NULL; + selectedInterfaces[1] = NULL; } }