diff -r e3f722759c7e -r 340bc29da9a0 branchitem.cpp --- a/branchitem.cpp Wed May 20 15:40:14 2009 +0000 +++ b/branchitem.cpp Tue May 26 11:23:44 2009 +0000 @@ -84,7 +84,13 @@ idAttr=""; */ - s=beginElement ("branch" + QString elementName; + if (parentItem==rootItem) + elementName="mapcenter"; + else + elementName="branch"; + + s=beginElement (elementName +getAttr() // +getOrnXMLAttr() +scrolledAttr @@ -146,7 +152,7 @@ */ decIndent(); - s+=endElement ("branch"); + s+=endElement (elementName); return s; } @@ -337,6 +343,15 @@ return NULL; } +void BranchItem::updateStyles() +{ + // FIXME-5 compare also MapItem::initLMO... + + if (lmo) + { + lmo->setParObj (parentItem->getLMO() ); + } +} BranchObj* BranchItem::getBranchObj() // FIXME-3 only for transition BO->BI { @@ -345,22 +360,50 @@ BranchObj* BranchItem::createMapObj(QGraphicsScene *scene) { + BranchObj *newbo; + cout << "BI::createMO "<setParObj(NULL); + newbo->setTreeItem (this); + newbo->setDefAttr(BranchObj::NewBranch); + } else + { // Initialize BranchObj, order of things is important... - BranchObj* newbo=new BranchObj(scene); - lmo=newbo; - BranchObj* parbo=(BranchObj*)(parentItem->getLMO()); - newbo->setParObj(parbo); - newbo->setTreeItem (this); - newbo->setDefAttr(BranchObj::NewBranch); - if (((BranchItem*)parentItem)->scrolled || !parbo->isVisibleObj() ) - newbo->setVisibility (false); - + cout << "BI::createMO (BO) "<getLMO()); + newbo->setParObj(parbo); + newbo->setTreeItem (this); + newbo->setDefAttr(BranchObj::NewBranch); + + if (parentItem->isBranchLikeType()) + { + // Set visibility depending on parents + if (((BranchItem*)parentItem)->scrolled || !parbo->isVisibleObj() ) + { + if (parentItem && parentItem->isBranchLikeType()) + cout <<" scrolled="<<((BranchItem*)parentItem)->scrolled<vis="<isVisibleObj()<setVisibility (false); + } + } else + cout <<" pI=no branch!\n"; + + } initLMO(); if (!getHeading().isEmpty() ) { - newbo->updateData(); //FIXME-3 maybe better model->emitDataHasChanged()? - newbo->setColor (headingColor); + ((BranchObj*)lmo)->updateData(); //FIXME-3 maybe better model->emitDataHasChanged()? + ((BranchObj*)lmo)->setColor (headingColor); }