From: asl Date: Thu, 18 Mar 2010 10:23:48 +0000 (+0000) Subject: on menu item remove menu action and item action should be removed, otherwise these... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0e44f990a79e388491affea27ac5804674174612;p=modules%2Fgui.git on menu item remove menu action and item action should be removed, otherwise these actions will be treated as "foreign" and menu item will exist in menu after remove --- diff --git a/src/Qtx/QtxActionMenuMgr.cxx b/src/Qtx/QtxActionMenuMgr.cxx index 90acf3ff7..9359f1215 100644 --- a/src/Qtx/QtxActionMenuMgr.cxx +++ b/src/Qtx/QtxActionMenuMgr.cxx @@ -491,8 +491,19 @@ void QtxActionMenuMgr::remove( const int id, const int pId, const int group ) delNodes.append( *it ); } + QWidget* mW = menuWidget( pNode ); for ( NodeList::iterator itr = delNodes.begin(); itr != delNodes.end(); ++itr ) + { + int id = (*itr)->id; + if( mW && menuAction( id ) ) + { + mW->removeAction( menuAction( id ) ); + myMenus.remove( id ); + } + else if( mW && itemAction( id ) ) + mW->removeAction( itemAction( id ) ); pNode->children.removeAll( *itr ); + } triggerUpdate( pNode->id, false ); } @@ -984,8 +995,10 @@ bool QtxActionMenuMgr::ownAction( QAction* a, MenuNode* node ) const for ( NodeList::const_iterator iter = node->children.begin(); iter != node->children.end(); ++iter ) { QAction* mya = itemAction( (*iter)->id ); - if ( !mya ) mya = menuAction( (*iter)->id ); - if ( mya && mya == a ) return true; + if ( !mya ) + mya = menuAction( (*iter)->id ); + if ( mya && mya == a ) + return true; } return false; }