Commit 1098166a by Alisa Jung

added some stuff to treeitem

parent e334b7ab
...@@ -23,7 +23,6 @@ public: ...@@ -23,7 +23,6 @@ public:
protected: protected:
int ID; int ID;
QString name;
int tesselation; int tesselation;
Type type; Type type;
}; };
......
...@@ -8,6 +8,7 @@ RigidBodyTransformation::RigidBodyTransformation(Primitive* child) ...@@ -8,6 +8,7 @@ RigidBodyTransformation::RigidBodyTransformation(Primitive* child)
// this->child = child; // this->child = child;
children.append(child); children.append(child);
name = "";
// qDebug() << "new rbt " << tx << "," << ty << "," << tz << ", rot " << rotation; // qDebug() << "new rbt " << tx << "," << ty << "," << tz << ", rot " << rotation;
} }
......
...@@ -46,3 +46,19 @@ TreeItem* TreeItem::getChild(int index){ ...@@ -46,3 +46,19 @@ TreeItem* TreeItem::getChild(int index){
} }
return 0; return 0;
} }
int TreeItem::columnCount(){
return 1;
}
QVariant TreeItem::data(int column){
if (column == 0) return QVariant(name);
else return QVariant("ERROR column index");
}
int TreeItem::childNumber(){
if (parent){
return parent->getChildren().indexOf(this);
}
return 0; //for root.
}
...@@ -14,14 +14,19 @@ public: ...@@ -14,14 +14,19 @@ public:
QList<TreeItem*> getChildren(); QList<TreeItem*> getChildren();
TreeItem* getChild(int index);//return 0 if index too large TreeItem* getChild(int index);//return 0 if index too large
int getChildrenCount(); int getChildrenCount();
int columnCount();
QVariant data(int column); //returns QVariant for name string
void addChild(TreeItem* item); void addChild(TreeItem* item);
bool removeChild(TreeItem* item); bool removeChild(TreeItem* item);
void setParent(TreeItem* parent); void setParent(TreeItem* parent);
int childNumber();
protected: protected:
TreeItem* parent; TreeItem* parent;
QList<TreeItem*> children; QList<TreeItem*> children;
QString name;
}; };
#endif // TREEITEM_H #endif // TREEITEM_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment