From 2609204fe3616fb1e40e3aa29d3079f5bcbb7fa0 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 11 Mar 2011 14:34:01 +0000 Subject: [PATCH] Additional changes for issue 20830: avoid toolbar blinking on "Show Only" operation --- src/CAM/CAM_Module.cxx | 62 ++++++++++++++++++++++++++++- src/LightApp/LightApp_Displayer.cxx | 7 ---- src/Qtx/QtxActionToolMgr.cxx | 1 + 3 files changed, 62 insertions(+), 8 deletions(-) diff --git a/src/CAM/CAM_Module.cxx b/src/CAM/CAM_Module.cxx index 8e39ab66b..7b31c6f2f 100755 --- a/src/CAM/CAM_Module.cxx +++ b/src/CAM/CAM_Module.cxx @@ -41,6 +41,24 @@ Provides support of menu/toolbars management. */ +class ActionMgrLocker +{ +public: + ActionMgrLocker( QtxActionMgr* m ) : myMgr( m ) + { + myUpdEnabled = myMgr->isUpdatesEnabled(); + myMgr->setUpdatesEnabled( false ); + } + ~ActionMgrLocker() + { + myMgr->setUpdatesEnabled( myUpdEnabled ); + //myMgr->update(); + } + + QtxActionMgr* myMgr; + bool myUpdEnabled; +}; + /*! \brief Default constructor. @@ -376,6 +394,8 @@ int CAM_Module::createTool( const QString& name ) if ( !toolMgr() ) return -1; + ActionMgrLocker lock( toolMgr() ); + return toolMgr()->createToolBar( name ); } @@ -403,8 +423,13 @@ int CAM_Module::createTool( QAction* a, const int tBar, const int id, const int if ( !toolMgr() ) return -1; + ActionMgrLocker lock( toolMgr() ); + int regId = registerAction( id, a ); int intId = toolMgr()->insert( a, tBar, idx ); + + setToolShown( a, false ); + return intId != -1 ? regId : -1; } @@ -432,8 +457,13 @@ int CAM_Module::createTool( QAction* a, const QString& tBar, const int id, const if ( !toolMgr() ) return -1; + ActionMgrLocker lock( toolMgr() ); + int regId = registerAction( id, a ); int intId = toolMgr()->insert( a, tBar, idx ); + + setToolShown( a, false ); + return intId != -1 ? regId : -1; } @@ -460,7 +490,12 @@ int CAM_Module::createTool( const int id, const int tBar, const int idx ) if ( !toolMgr() ) return -1; + ActionMgrLocker lock( toolMgr() ); + int intId = toolMgr()->insert( action( id ), tBar, idx ); + + setToolShown( action( id ), false ); + return intId != -1 ? id : -1; } @@ -487,7 +522,12 @@ int CAM_Module::createTool( const int id, const QString& tBar, const int idx ) if ( !toolMgr() ) return -1; + ActionMgrLocker lock( toolMgr() ); + int intId = toolMgr()->insert( action( id ), tBar, idx ); + + setToolShown( action( id ), false ); + return intId != -1 ? id : -1; } @@ -521,7 +561,7 @@ int CAM_Module::createMenu( const QString& subMenu, const int menu, { if ( !menuMgr() ) return -1; - + return menuMgr()->insert( subMenu, menu, group, id, idx ); } @@ -585,9 +625,14 @@ int CAM_Module::createMenu( QAction* a, const int menu, const int id, const int { if ( !a || !menuMgr() ) return -1; + + ActionMgrLocker lock( menuMgr() ); int regId = registerAction( id, a ); int intId = menuMgr()->insert( a, menu, group, idx ); + + setMenuShown( a, false ); + return intId != -1 ? regId : -1; } @@ -622,8 +667,13 @@ int CAM_Module::createMenu( QAction* a, const QString& menu, const int id, const if ( !a || !menuMgr() ) return -1; + ActionMgrLocker lock( menuMgr() ); + int regId = registerAction( id, a ); int intId = menuMgr()->insert( a, menu, group, idx ); + + setMenuShown( a, false ); + return intId != -1 ? regId : -1; } @@ -653,7 +703,12 @@ int CAM_Module::createMenu( const int id, const int menu, const int group, const if ( !menuMgr() ) return -1; + ActionMgrLocker lock( menuMgr() ); + int intId = menuMgr()->insert( action( id ), menu, group, idx ); + + setMenuShown( action( id ), false ); + return intId != -1 ? id : -1; } @@ -687,7 +742,12 @@ int CAM_Module::createMenu( const int id, const QString& menu, const int group, if ( !menuMgr() ) return -1; + ActionMgrLocker lock( menuMgr() ); + int intId = menuMgr()->insert( action( id ), menu, group, idx ); + + setMenuShown( action( id ), false ); + return intId != -1 ? id : -1; } diff --git a/src/LightApp/LightApp_Displayer.cxx b/src/LightApp/LightApp_Displayer.cxx index d88963bc9..e0605eb59 100644 --- a/src/LightApp/LightApp_Displayer.cxx +++ b/src/LightApp/LightApp_Displayer.cxx @@ -321,13 +321,6 @@ LightApp_Displayer* LightApp_Displayer::FindDisplayer( const QString& mod_name, if( m ) { m->connectToStudy( dynamic_cast( app->activeStudy() ) ); - //rnv: Implementation of the 20830: EDF 1357 GUI : Hide/Show Icon - // Seems it is not necessary hide icons: - // if( m!=app->activeModule() && load ) - // { - // m->setMenuShown( false ); - // m->setToolShown( false ); - // } } return m ? m->displayer() : 0; } diff --git a/src/Qtx/QtxActionToolMgr.cxx b/src/Qtx/QtxActionToolMgr.cxx index 6cdf72121..b815cc2c4 100644 --- a/src/Qtx/QtxActionToolMgr.cxx +++ b/src/Qtx/QtxActionToolMgr.cxx @@ -131,6 +131,7 @@ int QtxActionToolMgr::createToolBar( const QString& title, bool floatable, Qt::T if ( !tb ) { tb = new QtxToolBar( true, tbw ); + tb->setVisible( false ); // VSR: create toolbar visible initially tb->setFloatable( floatable ); tb->setAllowedAreas( dockAreas ); tb->setMovable( dockAreas & Qt::AllToolBarAreas ); -- 2.39.2