1.1 --- a/treeitem.cpp Fri Apr 09 14:24:04 2010 +0000
1.2 +++ b/treeitem.cpp Wed Jun 09 13:14:08 2010 +0000
1.3 @@ -17,7 +17,7 @@
1.4
1.5 TreeItem::TreeItem()
1.6 {
1.7 - cout << "Constr. TI this="<<this<<endl;
1.8 + //cout << "Constr. TI this="<<this<<endl;
1.9 init();
1.10 itemData.clear();
1.11 rootItem=this;
1.12 @@ -38,13 +38,30 @@
1.13
1.14 TreeItem::~TreeItem()
1.15 {
1.16 - //cout << "Destructor TreeItem "<<getHeadingStd()<<endl;
1.17 + //qDebug()<<"Destr TreeItem this="<<this<<" childcount="<<childItems.count();
1.18 + /*
1.19 + qDeleteAll(childItems); // Call delete //FIXME-3 use this instead of below
1.20 + qDebug()<<" ok1";
1.21 + childItems.clear(); // and clear list
1.22 + qDebug()<<" ok2";use
1.23 + */
1.24 +
1.25 + /*
1.26 + if (this==rootItem)
1.27 + {
1.28 + qDebug()<<" I'm rootItem, aborting";
1.29 + return;
1.30 + }
1.31 + */
1.32 + //qDebug()<<" ="<<getHeading();
1.33 TreeItem *ti;
1.34 while (!childItems.isEmpty())
1.35 {
1.36 + //qDebug()<<" ="<<ti->getHeading();
1.37 ti=childItems.takeFirst();
1.38 + //qDebug()<<" ti="<<ti;
1.39 delete ti;
1.40 - }
1.41 + }
1.42 }
1.43
1.44
1.45 @@ -316,6 +333,7 @@
1.46 void TreeItem::setHeading (const QString s)
1.47 {
1.48 itemData[0]=s;
1.49 + //qDebug()<<"TI::setHeading this="<<this<<" "<<s;
1.50 }
1.51
1.52 QString TreeItem::getHeading () const
1.53 @@ -591,9 +609,17 @@
1.54 {
1.55 if (n>=0 && n<branchCounter)
1.56 {
1.57 - return (BranchObj*)(getBranchNum(n)->getLMO());
1.58 - } else
1.59 - return NULL;
1.60 + BranchItem *bi=getBranchNum(n);
1.61 + if (bi)
1.62 + {
1.63 + BranchObj *bo=(BranchObj*)(bi->getLMO());
1.64 + if (bo)
1.65 + return bo;
1.66 + else
1.67 + qDebug()<<"TI::getBONum bo=NULL";
1.68 + }
1.69 + }
1.70 + return NULL;
1.71 }
1.72
1.73 ImageItem* TreeItem::getImageNum (const int &n)
1.74 @@ -634,14 +660,10 @@
1.75 if (xlinkCounter>0 )
1.76 {
1.77 XLinkItem *xli=getXLinkNum (n);
1.78 - if (!xli) return NULL;
1.79 - if (xli->isBegin() )
1.80 - return (XLinkObj*)(xli->getLMO());
1.81 - else
1.82 + if (xli)
1.83 {
1.84 - xli=xli->getPartnerXLink();
1.85 - if (!xli) return NULL;
1.86 - return (XLinkObj*)(xli->getLMO());
1.87 + Link *l=xli->getLink();
1.88 + if (l) return l->getXLinkObj();
1.89 }
1.90 }
1.91 return NULL;