Logo Search packages:      
Sourcecode: packagesearch version File versions

void NWidgets::TagSelectionListView::filterByTagSet (  )  [protected]

Hides all tags where selecting would result in an empty result list.

This iterates over all visible items and checks if they may be selected according to the demand stated above. If _pColl is not set (i.e. equals 0) the function does nothing.

Precondition:
all items that shall be processed must be visible.
See also:
_filterByNamePattern, filter()

Definition at line 185 of file tagselectionlistview.cpp.

References _pColl, _selected, and TagListViewItem::filterByTagset().

Referenced by filter().

{
      if (_pColl==0 || _selected.empty() ) return;
      TagListViewItem* pRoot = static_cast<TagListViewItem*>(firstChild());
      if (pRoot == 0)   // if we do not have a root
            return;
      Tagcoll::OpSet<string> selectedTags;
      // insert all items names in the new set
      transform(
            _selected.begin(), _selected.end(), 
            inserter(selectedTags, selectedTags.begin()),   // inserter to insert in the set
            mem_fun(&TagItem::fullTagname)
      );
      Tagcoll::OpSet<string> companionTags = _pColl->getCompanionTags(selectedTags);
      companionTags += selectedTags;
      pRoot->filterByTagset(companionTags);

/*    for ( iterator it = begin(QListViewItemIterator::Visible); it != end(); ++it)
      {
            // assumes that a child implies its parent, else the parent could be hidden and the 
            // child shown
            if ( companionTags.find(it->fullTagname()) == companionTags.end() )
                  it->setVisible(false);
      }*/
      
}


Generated by  Doxygen 1.6.0   Back to index