src/pluginswindow.cpp
// Update the selected state of all our categories which have at least one
// selectable plugin
Update the selected state of all our categories which have at least one
selectable plugin
Update the selected state of all our categories which have at least one selectable plugin
foreach (QStandardItem *categoryItem, mPluginCategories) {
        int nbOfPlugins = categoryItem->rowCount();
        if (nbOfPlugins) {
            int nbOfSelectablePlugins = 0;
            int nbOfUnselectablePlugins = 0;
            int nbOfSelectedSelectablePlugins = 0;
            for (int i = 0; i < nbOfPlugins; ++i) {
                QStandardItem *pluginItem = categoryItem->child(i);
                if (pluginItem->isCheckable()) {
                    ++nbOfSelectablePlugins;
                    if (pluginItem->checkState() == Qt::Checked)
                        ++nbOfSelectedSelectablePlugins;
                } else {
                    ++nbOfUnselectablePlugins;
                }
            }
            if (nbOfPlugins != nbOfUnselectablePlugins)
                categoryItem->setCheckState(nbOfSelectedSelectablePlugins?
                                                (nbOfSelectedSelectablePlugins == nbOfSelectablePlugins)?
                                                    Qt::Checked:
                                                    Qt::PartiallyChecked:
                                                Qt::Unchecked);
        }
    }
foreach ( QStandardItem * categoryItem , mPluginCategories ) { int nbOfPlugins = categoryItem -> rowCount ( ) ; if ( nbOfPlugins ) { int nbOfSelectablePlugins = 0 ; int nbOfUnselectablePlugins = 0 ; int nbOfSelectedSelectablePlugins = 0 ; for ( int i = 0 ; i < nbOfPlugins ; ++ i ) { QStandardItem * pluginItem = categoryItem -> child ( i ) ; if ( pluginItem -> isCheckable ( ) ) { ++ nbOfSelectablePlugins ; if ( pluginItem -> checkState ( ) == Qt :: Checked ) ++ nbOfSelectedSelectablePlugins ; } else { ++ nbOfUnselectablePlugins ; } } if ( nbOfPlugins != nbOfUnselectablePlugins ) categoryItem -> setCheckState ( nbOfSelectedSelectablePlugins ? ( nbOfSelectedSelectablePlugins == nbOfSelectablePlugins ) ? Qt :: Checked : Qt :: PartiallyChecked : Qt :: Unchecked ) ; } }
Update the selected state of all our categories which have at least one
selectable plugin
Update the selected state of all our categories which have at least one selectable plugin