50 #include "TreeItem.hh"
56 TreeItem::TreeItem(
int _id, QString _name,
DataType _type,
TreeItem* _parent) :
67 kTreeMap_[_id] =
this;
71 TreeItem::~TreeItem() {
73 QMap<int,TreeItem*>::iterator iter =
kTreeMap_.find(
id() );
77 std::cerr <<
"Map accelerator destructor in DataControl: Currently removing object that is not in the map!" << std::endl;
97 return ( dataType_ & _type);
122 return (
parent()->
id() );
127 bool TreeItem::isGroup() {
198 while ( parentPointer ) {
201 int position = thisPointer->
row() + 1;
202 if ( parentPointer->
childCount() > position ) {
207 thisPointer = parentPointer;
226 while ( current->
parent() != 0 ) {
228 current = current->
parent();
282 if ( id_ == _objectId )
286 QMap<int,TreeItem*>::const_iterator iter =
kTreeMap_.find(_objectId);
299 if ( current ==
this ) {
304 if ( current->
parent() != 0) {
305 current = current->
parent();
318 int idx = (_item != 0) ? _item->
row_ : -1;
321 std::cerr <<
"TreeItem: Illegal remove request" << std::endl;
336 QList< TreeItem* > items;
344 items.push_back(
this);
int row() const
get the row of this item from the parent
TreeItem * child(int row)
return a child
DataType dataType()
dataType
QList< TreeItem * > getLeafs()
get all leafes of the tree below this object ( These will be all visible objects ) ...
const DataType DATA_GROUP(1)
Items used for Grouping.
void removeChild(TreeItem *_item)
Remove a child from this object.
TreeItem * parentItem_
Parent item or 0 if root node.
int childCount() const
get the number of children
void setParent(TreeItem *_parent)
Set the parent pointer.
int row_
Index of this node in parent's childen.
QList< TreeItem * > childItems_
Children of this node.
TreeItem * parent()
Get the parent item ( 0 if root item )
const DataType DATA_ALL(UINT_MAX)
Identifier for all available objects.
TreeItem * childExists(int _objectId)
Check if the element exists in the subtree of this element.
static QMap< int, TreeItem * > kTreeMap_
Acceleration map.
void appendChild(TreeItem *child)
add a child to this node
void deleteSubtree()
delete the whole subtree below this item ( The item itself is not touched )