48TreeItem::TreeItem(
int _id,
const QString& _name,
DataType _type,
TreeItem* _parent) :
59 kTreeMap_[_id] =
this;
63TreeItem::~TreeItem() {
65 QMap<int,TreeItem*>::iterator iter =
kTreeMap_.find(
id() );
69 std::cerr <<
"Map accelerator destructor in DataControl: Currently removing object that is not in the map!" << std::endl;
89 return ( dataType_ & _type);
114 return (
parent()->
id() );
119bool TreeItem::isGroup() {
190 while ( parentPointer ) {
193 int position = thisPointer->
row() + 1;
194 if ( parentPointer->
childCount() > position ) {
199 thisPointer = parentPointer;
218 while ( current->
parent() != 0 ) {
220 current = current->
parent();
274 if ( id_ == _objectId )
278 QMap<int,TreeItem*>::const_iterator iter =
kTreeMap_.find(_objectId);
291 if ( current ==
this ) {
296 if ( current->
parent() != 0) {
297 current = current->
parent();
310 int idx = (_item != 0) ? _item->
row_ : -1;
313 std::cerr <<
"TreeItem: Illegal remove request" << std::endl;
328 QList< TreeItem* > items;
336 items.push_back(
this);
const DataType DATA_ALL(UINT_MAX)
Identifier for all available objects.
const DataType DATA_GROUP(1)
Items used for Grouping.
int childCount() const
get the number of children
QList< TreeItem * > getLeafs()
get all leafes of the tree below this object ( These will be all visible objects )
TreeItem * parentItem_
Parent item or 0 if root node.
TreeItem * parent()
Get the parent item ( 0 if root item )
int row_
Index of this node in parent's childen.
DataType dataType()
dataType
QList< TreeItem * > childItems_
Children of this node.
TreeItem * child(int row)
return a child
void deleteSubtree()
delete the whole subtree below this item ( The item itself is not touched )
int row() const
get the row of this item from the parent
static QMap< int, TreeItem * > kTreeMap_
Acceleration map.
void appendChild(TreeItem *child)
add a child to this node
void setParent(TreeItem *_parent)
Set the parent pointer.
void removeChild(TreeItem *_item)
Remove a child from this object.
TreeItem * childExists(int _objectId)
Check if the element exists in the subtree of this element.