1.1 --- a/treeitem.cpp Mon Aug 03 10:42:12 2009 +0000
1.2 +++ b/treeitem.cpp Thu Aug 06 10:42:17 2009 +0000
1.3 @@ -72,8 +72,11 @@
1.4 imageOffset=0;
1.5 imageCounter=0;
1.6
1.7 + attributeCounter=0;
1.8 + attributeOffset=0;
1.9 +
1.10 note.setNote("");
1.11 - // note.setFontHint (textEditor->getFontHintDefault() ); //FIXME-2
1.12 + // note.setFontHint (textEditor->getFontHintDefault() ); //FIXME-3
1.13 // isNoteInEditor=false;
1.14
1.15 hidden=false;
1.16 @@ -87,7 +90,7 @@
1.17
1.18
1.19 /*
1.20 -void TreeItem::copy (OrnamentedObj* other) //FIXME-2 probably need deep copy of branches and data!
1.21 +void TreeItem::copy (OrnamentedObj* other) //FIXME-3 probably need deep copy of branches and data!
1.22
1.23 {
1.24 note.copy (other->note);
1.25 @@ -111,9 +114,10 @@
1.26 {
1.27 switch (item->type)
1.28 {
1.29 + case Attribute: return attributeOffset + attributeCounter;
1.30 + case Image: return imageOffset + imageCounter;
1.31 case MapCenter: return branchOffset + branchCounter;
1.32 case Branch: return branchOffset + branchCounter;
1.33 - case Image: return imageOffset + imageCounter;
1.34 default: return -1;
1.35 }
1.36 }
1.37 @@ -124,12 +128,18 @@
1.38 item->rootItem=rootItem;
1.39 item->setModel (model);
1.40
1.41 + if (item->type == Attribute)
1.42 + {
1.43 + // attribute are on top of list
1.44 + childItems.insert (attributeCounter,item);
1.45 + attributeCounter++;
1.46 + imageOffset++;
1.47 + branchOffset++;
1.48 + }
1.49 +
1.50 if (item->type == Image)
1.51 {
1.52 - childItems.insert (imageCounter,item);
1.53 - // images are on top of list
1.54 - if (imageCounter==0)
1.55 - imageOffset=0;
1.56 + childItems.insert (imageCounter+imageOffset,item);
1.57 imageCounter++;
1.58 branchOffset++;
1.59 }
1.60 @@ -138,8 +148,6 @@
1.61 {
1.62 // branches are on bottom of list
1.63 childItems.append(item);
1.64 - if (branchCounter==0)
1.65 - branchOffset=childItems.count()-1;
1.66 branchCounter++;
1.67 }
1.68 }
1.69 @@ -150,14 +158,20 @@
1.70 qWarning ("TreeItem::removeChild tried to remove non existing item?!\n");
1.71 else
1.72 {
1.73 - if (childItems.at(row)->isBranchLikeType())
1.74 - branchCounter--;
1.75 + if (childItems.at(row)->type==Attribute)
1.76 + {
1.77 + attributeCounter--;
1.78 + imageOffset--;
1.79 + branchOffset--;
1.80 + }
1.81 if (childItems.at(row)->type==Image)
1.82 {
1.83 imageCounter--;
1.84 - if (branchOffset>0)
1.85 - branchOffset--;
1.86 + branchOffset--;
1.87 }
1.88 + if (childItems.at(row)->isBranchLikeType())
1.89 + branchCounter--;
1.90 +
1.91 childItems.removeAt (row);
1.92 }
1.93 }
1.94 @@ -210,6 +224,11 @@
1.95 return xlinkCounter; // FIXME-1 xlinkCounter needs to be calculated...
1.96 }
1.97
1.98 +int TreeItem::attributeCount() const
1.99 +{
1.100 + return attributeCounter;
1.101 +}
1.102 +
1.103 int TreeItem::row() const
1.104 {
1.105 if (parentItem)