52 #include "TreeItemObjectSelection.hh" 81 return ( dataType_ & _type);
98 if ( parent()->parent() == 0 )
106 return ( parent()->
id() );
111 bool TreeItemObjectSelection::isGroup() {
147 if ( childItems_.size() > 0 ) {
148 return childItems_[0];
158 while ( parentPointer ) {
161 if ( parentPointer->
childCount() > ( thisPointer->
row() + 1) ) {
166 thisPointer = parentPointer;
185 while ( current->
parent() != 0 ) {
187 current = current->
parent();
198 return parentItem_->childItems_.indexOf(const_cast<TreeItemObjectSelection*>(
this));
213 parentItem_ = _parent;
220 childItems_.append(item);
227 return childItems_.value(row);
234 return childItems_.count();
242 if ( id_ == _objectId )
246 for (
int i = 0 ; i < childItems_.size(); ++i ) {
260 if ( name() == _name )
264 for (
int i = 0 ; i < childItems_.size(); ++i ) {
278 QList<TreeItemObjectSelection*>::iterator i;
279 for (i = childItems_.begin(); i != childItems_.end(); ++i) {
287 std::cerr <<
"TreeItemObjectSelection: Illegal remove request" << std::endl;
291 childItems_.erase(i);
298 QList< TreeItemObjectSelection* > items;
300 for (
int i = 0 ; i < childItems_.size(); ++i ) {
301 items = items + childItems_[i]->getLeafs();
305 if ( childCount() == 0 )
306 items.push_back(
this);
316 for (
int i = 0 ; i < childItems_.size(); ++i) {
319 childItems_[i]->deleteSubtree();
322 delete childItems_[i];
void appendChild(TreeItemObjectSelection *child)
add a child to this node
TreeItemObjectSelection * parentItem_
Parent item or 0 if rootnode.
TreeItemObjectSelection * next()
TreeItemObjectSelection * parent()
Get the parent item ( 0 if rootitem )
int row() const
get the row of this item from the parent
const DataType DATA_ALL(UINT_MAX)
Identifier for all available objects.
void deleteSubtree()
delete the whole subtree below this item ( The item itself is not touched )
const DataType DATA_GROUP(1)
Items used for Grouping.
DataType dataType()
dataType
QList< TreeItemObjectSelection * > getLeafs()
get all leafes of the tree below this object ( These will be all visible objects ) ...
void removeChild(TreeItemObjectSelection *_item)
Remove a child from this object.
TreeItemObjectSelection * child(int row)
return a child
QList< TreeItemObjectSelection * > childItems_
Children of this node.
void setParent(TreeItemObjectSelection *_parent)
Set the parent pointer.
int childCount() const
get the number of children
TreeItemObjectSelection * childExists(int _objectId)
Check if the element exists in the subtree of this element.