vlc_linux/vlc-3.0.16/modules/gui/qt/components/complete_preferences.cpp
/* apply filter on tree item and recursively on its sub items
 * returns whether the item was filtered */
apply filter on tree item and recursively on its sub items
returns whether the item was filtered
apply filter on tree item and recursively on its sub items returns whether the item was filtered
bool PrefsTree::filterItems( QTreeWidgetItem *item, const QString &text,
                           Qt::CaseSensitivity cs )
{
    bool sub_filtered = true;
    for( int i = 0; i < item->childCount(); i++ )
    {
        QTreeWidgetItem *sub_item = item->child( i );
        if ( !filterItems( sub_item, text, cs ) )
        {
            sub_filtered = false;
        }
    }
    PrefsItemData *data = item->data( 0, Qt::UserRole ).value<PrefsItemData *>();
    bool filtered = sub_filtered && !data->contains( text, cs );
    if ( b_show_only_loaded && sub_filtered && !data->b_loaded )
        filtered = true;
    item->setExpanded( !sub_filtered );
    item->setHidden( filtered );
    return filtered;
}
bool PrefsTree :: filterItems ( QTreeWidgetItem * item , const QString & text , Qt :: CaseSensitivity cs ) { bool sub_filtered = true ; for ( int i = 0 ; i < item -> childCount ( ) ; i ++ ) { QTreeWidgetItem * sub_item = item -> child ( i ) ; if ( ! filterItems ( sub_item , text , cs ) ) { sub_filtered = false ; } } PrefsItemData * data = item -> data ( 0 , Qt :: UserRole ) . value < PrefsItemData * > ( ) ; bool filtered = sub_filtered && ! data -> contains ( text , cs ) ; if ( b_show_only_loaded && sub_filtered && ! data -> b_loaded ) filtered = true ; item -> setExpanded ( ! sub_filtered ) ; item -> setHidden ( filtered ) ; return filtered ; }
apply filter on tree item and recursively on its sub items
 returns whether the item was filtered
apply filter on tree item and recursively on its sub items returns whether the item was filtered
/* not all the sub items were filtered */