treeitem.cpp
changeset 773 340bc29da9a0
parent 772 e3f722759c7e
child 776 25e634a7e1dc
     1.1 --- a/treeitem.cpp	Wed May 20 15:40:14 2009 +0000
     1.2 +++ b/treeitem.cpp	Tue May 26 11:23:44 2009 +0000
     1.3 @@ -5,7 +5,6 @@
     1.4  
     1.5  #include "branchobj.h"
     1.6  #include "branchitem.h"
     1.7 -#include "mapcenteritem.h"
     1.8  #include "vymmodel.h"
     1.9  
    1.10  using namespace std;
    1.11 @@ -14,10 +13,14 @@
    1.12  
    1.13  TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent):MapItem()
    1.14  {
    1.15 -	//cout << "Constructor TreeItem "<<endl;
    1.16 +	//cout << "Constructor TreeItem this="<<this<<"  parent="<<parent<<endl;
    1.17  	init();
    1.18      parentItem = parent;
    1.19      itemData = data;
    1.20 +	
    1.21 +	rootItem=this;
    1.22 +	if (parentItem )
    1.23 +		rootItem=parentItem->rootItem;
    1.24  }
    1.25  
    1.26  TreeItem::~TreeItem()
    1.27 @@ -30,7 +33,7 @@
    1.28  		switch (ti->getType() )
    1.29  		{
    1.30  			case TreeItem::MapCenter:
    1.31 -				delete (MapCenterItem*)ti;
    1.32 +				delete (BranchItem*)ti;
    1.33  				break;
    1.34  			case TreeItem::Branch:
    1.35  				delete (BranchItem*)ti;
    1.36 @@ -69,12 +72,6 @@
    1.37  	standardFlags.setMasterRow (standardFlagsMaster);
    1.38  }
    1.39  
    1.40 -QString TreeItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset)
    1.41 -{
    1.42 -	cout<< "TreeItem::saveToDir called directly for ("<<getHeadingStd()<<"), instead of inherited type...\n";
    1.43 -	return QString();
    1.44 -}
    1.45 -
    1.46  
    1.47  /*
    1.48  void TreeItem::copy (OrnamentedObj* other)	//FIXME-2	probably need deep copy of branches and data!
    1.49 @@ -101,6 +98,7 @@
    1.50  {
    1.51      childItems.append(item);
    1.52  	item->parentItem=this;
    1.53 +	item->rootItem=rootItem;
    1.54  	item->setModel (model);
    1.55  
    1.56  	if (item->type == Branch || item->type ==MapCenter)