vlc_linux/vlc-3.0.16/modules/gui/qt/components/complete_preferences.cpp
/* collapse item if it's not selected or one of its sub items
 * returns whether the item was collapsed */
collapse item if it's not selected or one of its sub items
returns whether the item was collapsed
collapse item if it ' s not selected or one of its sub items returns whether the item was collapsed
bool PrefsTree::collapseUnselectedItems( QTreeWidgetItem *item )
{
    bool sub_collapsed = true;
    for( int i = 0; i < item->childCount(); i++ )
    {
        QTreeWidgetItem *sub_item = item->child( i );
        if ( !collapseUnselectedItems( sub_item ) )
        {
            sub_collapsed = false;
        }
    }
    bool collapsed = sub_collapsed && !item->isSelected();
    item->setExpanded( !sub_collapsed );
    item->setHidden( false );
    return collapsed;
}
bool PrefsTree :: collapseUnselectedItems ( QTreeWidgetItem * item ) { bool sub_collapsed = true ; for ( int i = 0 ; i < item -> childCount ( ) ; i ++ ) { QTreeWidgetItem * sub_item = item -> child ( i ) ; if ( ! collapseUnselectedItems ( sub_item ) ) { sub_collapsed = false ; } } bool collapsed = sub_collapsed && ! item -> isSelected ( ) ; item -> setExpanded ( ! sub_collapsed ) ; item -> setHidden ( false ) ; return collapsed ; }
collapse item if it's not selected or one of its sub items
 returns whether the item was collapsed
collapse item if it ' s not selected or one of its sub items returns whether the item was collapsed
/* not all the sub items were collapsed */