Logo Search packages:      
Sourcecode: ktechlab version File versions  Download package

ItemList ItemGroup::items ( bool  excludeParented = true  )  const [inherited]

Returns a list of all the Items in the group.

Parameters:
excludeParented whether to return items whose (grand-) parents are already in the list.

Definition at line 43 of file itemgroup.cpp.

Referenced by CNItemGroup::connectors(), ICNDocument::copy(), CircuitDocument::createSubcircuit(), CircuitDocument::fillContextMenu(), CNItemGroup::mergeGroup(), CMItemMove::mouseMoved(), CMItemMove::mousePressedInitial(), CMMechItemMove::mouseReleased(), CMItemMove::mouseReleased(), and CNItemGroup::nodes().

{
      if (excludeParentedItems)
            return m_itemList;
      
      ItemList items = m_itemList;
      ItemList parents = m_itemList;
      
      uint oldSize = items.size();
      do
      {
            oldSize = items.size();
            ItemList children;
            
            ItemList::iterator end = parents.end();
            for ( ItemList::iterator it = parents.begin(); it != end; ++it )
                  children += (*it)->children();
            
            end = children.end();
            for ( ItemList::iterator it = children.begin(); it != end; ++it )
            {
                  if ( children.contains(*it) > 1 )
                        *it = 0l;
            }
            children.remove((Item*)0l);
            
            items += children;
            parents = children;
      }
      while ( oldSize != items.size() );
      
      return items;
}


Generated by  Doxygen 1.6.0   Back to index