[netinstall] Don't update selection state for items with no children

The special setup for nicely-named groups which have a single
hidden subgroup containing the actual packages, has the problem
that there is a non-empty subgroups item, but this results
in zero actual children: then the number of selected and partly
selected children is also zero in updateSelected() and therefore
the item ends up unselected.

Special-case this to avoid unnecessarily unselecting the item.
Reported by Vitor L.
This commit is contained in:
Adriaan de Groot 2020-10-20 23:15:32 +02:00
parent bf50f8724d
commit 0cb6c89876

View File

@ -267,8 +267,13 @@ PackageModel::setupModelData( const QVariantList& groupList, PackageTreeItem* pa
setupModelData( subgroups, item ); setupModelData( subgroups, item );
// The children might be checked while the parent isn't (yet). // The children might be checked while the parent isn't (yet).
// Children are added to their parent (below) without affecting // Children are added to their parent (below) without affecting
// the checked-state -- do it manually. // the checked-state -- do it manually. Items with subgroups
item->updateSelected(); // but no children have only hidden children -- those get
// handled specially.
if ( item->childCount() > 0 )
{
item->updateSelected();
}
} }
else else
{ {