46 #include "TreeItemObjectSelection.hh" 75 return ( dataType_ & _type);
92 if ( parent()->parent() == 0 )
100 return ( parent()->
id() );
105 bool TreeItemObjectSelection::isGroup() {
141 if ( childItems_.size() > 0 ) {
142 return childItems_[0];
152 while ( parentPointer ) {
155 if ( parentPointer->
childCount() > ( thisPointer->
row() + 1) ) {
160 thisPointer = parentPointer;
179 while ( current->
parent() != 0 ) {
181 current = current->
parent();
192 return parentItem_->childItems_.indexOf(const_cast<TreeItemObjectSelection*>(
this));
207 parentItem_ = _parent;
214 childItems_.append(item);
221 return childItems_.value(row);
228 return childItems_.count();
236 if ( id_ == _objectId )
240 for (
int i = 0 ; i < childItems_.size(); ++i ) {
254 if ( name() == _name )
258 for (
int i = 0 ; i < childItems_.size(); ++i ) {
272 QList<TreeItemObjectSelection*>::iterator i;
273 for (i = childItems_.begin(); i != childItems_.end(); ++i) {
281 std::cerr <<
"TreeItemObjectSelection: Illegal remove request" << std::endl;
285 childItems_.erase(i);
292 QList< TreeItemObjectSelection* > items;
294 for (
int i = 0 ; i < childItems_.size(); ++i ) {
295 items = items + childItems_[i]->getLeafs();
299 if ( childCount() == 0 )
300 items.push_back(
this);
310 for (
int i = 0 ; i < childItems_.size(); ++i) {
313 childItems_[i]->deleteSubtree();
316 delete childItems_[i];
TreeItemObjectSelection * parentItem_
Parent item or 0 if rootnode.
TreeItemObjectSelection * next()
DataType dataType()
dataType
int childCount() const
get the number of children
TreeItemObjectSelection * parent()
Get the parent item ( 0 if rootitem )
void removeChild(TreeItemObjectSelection *_item)
Remove a child from this object.
void setParent(TreeItemObjectSelection *_parent)
Set the parent pointer.
void appendChild(TreeItemObjectSelection *child)
add a child to this node
void deleteSubtree()
delete the whole subtree below this item ( The item itself is not touched )
QList< TreeItemObjectSelection * > childItems_
Children of this node.
TreeItemObjectSelection * childExists(int _objectId)
Check if the element exists in the subtree of this element.
TreeItemObjectSelection * child(int row)
return a child
QList< TreeItemObjectSelection *> 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.
const DataType DATA_ALL(UINT_MAX)
Identifier for all available objects.
int row() const
get the row of this item from the parent