From 0cb6c89876f88e17a364df38264df9371c3c320a Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 20 Oct 2020 23:15:32 +0200 Subject: [PATCH] [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. --- src/modules/netinstall/PackageModel.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/modules/netinstall/PackageModel.cpp b/src/modules/netinstall/PackageModel.cpp index 147bd5a5c..d4887b6c2 100644 --- a/src/modules/netinstall/PackageModel.cpp +++ b/src/modules/netinstall/PackageModel.cpp @@ -267,8 +267,13 @@ PackageModel::setupModelData( const QVariantList& groupList, PackageTreeItem* pa setupModelData( subgroups, item ); // The children might be checked while the parent isn't (yet). // Children are added to their parent (below) without affecting - // the checked-state -- do it manually. - item->updateSelected(); + // the checked-state -- do it manually. Items with subgroups + // but no children have only hidden children -- those get + // handled specially. + if ( item->childCount() > 0 ) + { + item->updateSelected(); + } } else {