Browse Source

Recursively call evaluate on submenus of conditional menus

There seems to be a bug with certain GTK setups that prevents the
submenus from getting sized correctly unless the elements are added
when the main menu is displayed.

Fixes: lp:1835460
* https://bugs.launchpad.net/kicad/+bug/1835460
pull/15/head
Ian McInerney 6 years ago
committed by Jeff Young
parent
commit
05429bc39c
  1. 12
      common/tool/conditional_menu.cpp

12
common/tool/conditional_menu.cpp

@ -197,6 +197,18 @@ void CONDITIONAL_MENU::Evaluate( SELECTION& aSelection )
menuItem->Enable( result );
}
}
// Recursively call Evaluate on all the submenus that are CONDITIONAL_MENUs to ensure
// they are updated. This is also required on GTK to make sure the menus have the proper
// size when created.
runOnSubmenus(
[&aSelection]( ACTION_MENU* aMenu )
{
CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( aMenu );
if( conditionalMenu )
conditionalMenu->Evaluate( aSelection );
} );
}

Loading…
Cancel
Save