Single menuitem for plugin

This commit is contained in:
EugenyP 2023-07-20 23:33:54 +07:00
parent 5e0d1b789d
commit cf898449f7

View File

@ -41,12 +41,14 @@ void PlugInMenu_Add( QMenu* plugin_menu, IPlugIn* pPlugIn ){
const char *menuText; const char *menuText;
MenuStack menuStack; MenuStack menuStack;
std::size_t nCount = pPlugIn->getCommandCount();
globalErrorStream() << pPlugIn->getMenuName() << " mismatched > <. " << menuStack.size() << " submenu(s) not closed.\n";
{
globalErrorStream() << pPlugIn->getMenuName() << " count: " << nCount << "\n";
if (nCount > 1) {
menu = plugin_menu->addMenu( pPlugIn->getMenuName() ); menu = plugin_menu->addMenu( pPlugIn->getMenuName() );
menu->setTearOffEnabled( g_Layout_enableDetachableMenus.m_value ); menu->setTearOffEnabled( g_Layout_enableDetachableMenus.m_value );
std::size_t nCount = pPlugIn->getCommandCount();
{
while ( nCount > 0 ) while ( nCount > 0 )
{ {
menuText = pPlugIn->getCommandTitle( --nCount ); menuText = pPlugIn->getCommandTitle( --nCount );
@ -88,6 +90,14 @@ void PlugInMenu_Add( QMenu* plugin_menu, IPlugIn* pPlugIn ){
if ( !menuStack.empty() ) { if ( !menuStack.empty() ) {
globalErrorStream() << pPlugIn->getMenuName() << " mismatched > <. " << menuStack.size() << " submenu(s) not closed.\n"; globalErrorStream() << pPlugIn->getMenuName() << " mismatched > <. " << menuStack.size() << " submenu(s) not closed.\n";
} }
} else if (nCount == 1) {
menuText = pPlugIn->getCommandTitle( --nCount );
if ( menuText != 0 && strlen( menuText ) > 0 ) {
create_menu_item_with_mnemonic( plugin_menu, menuText, pPlugIn->getGlobalCommand( nCount ) );
}
}
} }
} }