From d94990bd1012d3fdf15554944978cc877fa538ab Mon Sep 17 00:00:00 2001 From: Aleksei Nikiforov Date: Fri, 14 Feb 2020 14:49:00 +0300 Subject: [PATCH] Hide group menu if they have no children --- khelpcenter/navigatorappgroupitem.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/khelpcenter/navigatorappgroupitem.cpp b/khelpcenter/navigatorappgroupitem.cpp index 07389af8..1d888d81 100644 --- a/khelpcenter/navigatorappgroupitem.cpp +++ b/khelpcenter/navigatorappgroupitem.cpp @@ -93,6 +93,7 @@ void NavigatorAppGroupItem::populate( bool recursive ) return; } KServiceGroup::List list = root->entries(); + bool no_children_present = true; for ( KServiceGroup::List::ConstIterator it = list.constBegin(); @@ -110,6 +111,7 @@ void NavigatorAppGroupItem::populate( bool recursive ) DocEntry *entry = new DocEntry( s->name(), url, s->icon() ); NavigatorAppItem *item = new NavigatorAppItem( entry, this ); item->setAutoDeleteDocEntry( true ); + no_children_present = false; } break; } @@ -123,6 +125,7 @@ void NavigatorAppGroupItem::populate( bool recursive ) appItem = new NavigatorAppGroupItem( entry, this, g->relPath() ); appItem->setAutoDeleteDocEntry( true ); if ( recursive ) appItem->populate( recursive ); + no_children_present = false; break; } default: @@ -131,6 +134,7 @@ void NavigatorAppGroupItem::populate( bool recursive ) } sortChildren( 0, Qt::AscendingOrder /* ascending */ ); mPopulated = true; + setHidden(no_children_present); } QString NavigatorAppGroupItem::documentationURL( const KService *s ) -- 2.24.1