branchitem.cpp
changeset 791 f1006de05c54
parent 790 133e2ed6b9c5
child 795 6b0a5f4923d3
     1.1 --- a/branchitem.cpp	Thu Sep 03 08:52:00 2009 +0000
     1.2 +++ b/branchitem.cpp	Mon Sep 07 15:36:57 2009 +0000
     1.3 @@ -12,6 +12,8 @@
     1.4  {
     1.5  	//cout << "Constr. BranchItem\n";
     1.6  
     1.7 +	// Set type if parent is known yet 
     1.8 +	// if not, type is set in insertBranch or TreeItem::appendChild
     1.9  	if (parent==rootItem)
    1.10  		setType (MapCenter);
    1.11  	else
    1.12 @@ -49,7 +51,13 @@
    1.13  	if (pos>branchCounter) pos=branchCounter;
    1.14      childItems.insert(pos+branchOffset,branch);
    1.15  	branch->parentItem=this;
    1.16 +	branch->rootItem=rootItem;
    1.17  	branch->setModel (model);
    1.18 +	if (parentItem==rootItem)
    1.19 +		setType (MapCenter);
    1.20 +	else
    1.21 +		setType (Branch);
    1.22 +
    1.23  
    1.24  	if (branchCounter==0)
    1.25  		branchOffset=childItems.count()-1;
    1.26 @@ -425,7 +433,8 @@
    1.27  	{
    1.28  		newbo->setParObj( ((MapItem*)parentItem)->getLMO() );
    1.29  		// Set visibility depending on parents
    1.30 -		if (((BranchItem*)parentItem)->scrolled || !((MapItem*)parentItem)->getLMO()->isVisibleObj() )
    1.31 +		if (parentItem!=rootItem && 
    1.32 +			( ((BranchItem*)parentItem)->scrolled || !((MapItem*)parentItem)->getLMO()->isVisibleObj() ) )
    1.33  			newbo->setVisibility (false);
    1.34  	}
    1.35  	newbo->setDefAttr(BranchObj::NewBranch);