X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/d30c9cf675ad7141d1c8e31d2e72315267d45cf2..4005a2dc6a4d35a5cdf2bb0b5479b5a2ca63b39c:/GroupScene.cpp?ds=sidebyside diff --git a/GroupScene.cpp b/GroupScene.cpp index daf6bf1..e8c9e84 100644 --- a/GroupScene.cpp +++ b/GroupScene.cpp @@ -86,15 +86,8 @@ QList GroupScene::getGroupAndBlocks() { BoxItem *GroupScene::createBlockItem(AbstractBlock *block) { - BoxItem* blockItem = new BoxItem(block,dispatcher,params,groupItem); - blockItem->setZValue(1); - addBlockItem(blockItem); - return blockItem; -} - -void GroupScene::addBlockItem(BoxItem* item) { - // add item from the viewport - //addItem(item); + BoxItem* item = new BoxItem(block,dispatcher,params,groupItem); + item->setZValue(1); // add item from the QList blockItems.append(item); // repainting the group @@ -102,7 +95,16 @@ void GroupScene::addBlockItem(BoxItem* item) { // center the new block QPointF newPos((groupItem->getWidth()-item->getTotalWidth())/2.0, (groupItem->getHeight()-item->getTotalHeight())/2.0); newPos = newPos-item->getOriginPoint(); - item->moveTo(newPos); + item->moveTo(newPos); + + return item; +} + +void GroupScene::addBlockItem(BoxItem* item) { + // add item from the QList + blockItems.append(item); + // repainting the group + groupItem->updateShape(); } void GroupScene::removeBlockItem(BoxItem* item) { @@ -187,6 +189,12 @@ void GroupScene::updateConnectionItemsShape() { void GroupScene::save(QXmlStreamWriter &writer) { writer.writeStartElement("scene"); writer.writeAttribute("id",QString::number(id)); + if (parentScene == NULL) { + writer.writeAttribute("upper_scene",QString::number(-1)); + } + else { + writer.writeAttribute("upper_scene",QString::number(parentScene->getId())); + } groupItem->save(writer); writer.writeStartElement("block_items");