diff -r 5987f9f15bac -r 6269016c9905 treeitem.cpp --- a/treeitem.cpp Mon Aug 03 10:42:12 2009 +0000 +++ b/treeitem.cpp Thu Aug 06 10:42:17 2009 +0000 @@ -72,8 +72,11 @@ imageOffset=0; imageCounter=0; + attributeCounter=0; + attributeOffset=0; + note.setNote(""); - // note.setFontHint (textEditor->getFontHintDefault() ); //FIXME-2 + // note.setFontHint (textEditor->getFontHintDefault() ); //FIXME-3 // isNoteInEditor=false; hidden=false; @@ -87,7 +90,7 @@ /* -void TreeItem::copy (OrnamentedObj* other) //FIXME-2 probably need deep copy of branches and data! +void TreeItem::copy (OrnamentedObj* other) //FIXME-3 probably need deep copy of branches and data! { note.copy (other->note); @@ -111,9 +114,10 @@ { switch (item->type) { + case Attribute: return attributeOffset + attributeCounter; + case Image: return imageOffset + imageCounter; case MapCenter: return branchOffset + branchCounter; case Branch: return branchOffset + branchCounter; - case Image: return imageOffset + imageCounter; default: return -1; } } @@ -124,12 +128,18 @@ item->rootItem=rootItem; item->setModel (model); + if (item->type == Attribute) + { + // attribute are on top of list + childItems.insert (attributeCounter,item); + attributeCounter++; + imageOffset++; + branchOffset++; + } + if (item->type == Image) { - childItems.insert (imageCounter,item); - // images are on top of list - if (imageCounter==0) - imageOffset=0; + childItems.insert (imageCounter+imageOffset,item); imageCounter++; branchOffset++; } @@ -138,8 +148,6 @@ { // branches are on bottom of list childItems.append(item); - if (branchCounter==0) - branchOffset=childItems.count()-1; branchCounter++; } } @@ -150,14 +158,20 @@ qWarning ("TreeItem::removeChild tried to remove non existing item?!\n"); else { - if (childItems.at(row)->isBranchLikeType()) - branchCounter--; + if (childItems.at(row)->type==Attribute) + { + attributeCounter--; + imageOffset--; + branchOffset--; + } if (childItems.at(row)->type==Image) { imageCounter--; - if (branchOffset>0) - branchOffset--; + branchOffset--; } + if (childItems.at(row)->isBranchLikeType()) + branchCounter--; + childItems.removeAt (row); } } @@ -210,6 +224,11 @@ return xlinkCounter; // FIXME-1 xlinkCounter needs to be calculated... } +int TreeItem::attributeCount() const +{ + return attributeCounter; +} + int TreeItem::row() const { if (parentItem)