From cf477fd99cdd9abcdae71fb4125a2fef74efb1ee Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 17 Jun 2005 14:59:45 +0000 Subject: [PATCH] Add method updateObjectBrowser() for the SalomeApp_Application --- src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx | 4 ++-- src/SALOME_SWIG/SALOMEGUI_Swig.cxx | 4 +--- src/SalomeApp/SalomeApp_Application.cxx | 23 +++++++++++++++-------- src/SalomeApp/SalomeApp_Application.h | 2 ++ 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx index f76a0049a..3fd124529 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx @@ -334,8 +334,8 @@ void SalomePyQt::updateObjBrowser( const int studyId, bool updateSelection ) QPtrListIterator it( apps ); for( ; it.current(); ++it ) { SalomeApp_Application* anApp = dynamic_cast( it.current() ); - if ( anApp && anApp->activeStudy() && anApp->activeStudy()->id() == myStudyId && anApp->objectBrowser() ) - anApp->objectBrowser()->updateTree(); + if ( anApp && anApp->activeStudy() && anApp->activeStudy()->id() == myStudyId ) + anApp->updateObjectBrowser(); } } } diff --git a/src/SALOME_SWIG/SALOMEGUI_Swig.cxx b/src/SALOME_SWIG/SALOMEGUI_Swig.cxx index 279d39515..848e4167d 100644 --- a/src/SALOME_SWIG/SALOMEGUI_Swig.cxx +++ b/src/SALOME_SWIG/SALOMEGUI_Swig.cxx @@ -137,9 +137,7 @@ void SALOMEGUI_Swig::updateObjBrowser( bool /*updateSelection*/ ) TEvent() {} virtual void Execute() { if ( SalomeApp_Application* anApp = getApplication() ) { - OB_Browser* browser = anApp->objectBrowser(); - if ( browser ) - browser->updateTree(); + anApp->updateObjectBrowser(); } } }; diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 6aae237c8..4a5c18854 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -572,16 +572,9 @@ void SalomeApp_Application::onSelectionChanged() } } - void SalomeApp_Application::onRefresh() { - for ( ModuleListIterator it = modules(); it.current(); ++it ) - { - CAM_DataModel* camDM = it.current()->dataModel(); - if ( camDM && camDM->inherits( "SalomeApp_DataModel" ) ) - ((SalomeApp_DataModel*)camDM)->update(); - } - objectBrowser()->updateTree(); + updateObjectBrowser( true ); } void SalomeApp_Application::setActiveStudy( SUIT_Study* study ) @@ -1398,3 +1391,17 @@ void SalomeApp_Application::contextMenuPopup( const QString& type, QPopupMenu* t thePopup->insertItem( tr( "MEN_REFRESH" ), this, SLOT( onRefresh() ) ); } +void SalomeApp_Application::updateObjectBrowser( const bool updateModels ) +{ + if ( updateModels ) + { + for ( ModuleListIterator it = modules(); it.current(); ++it ) + { + CAM_DataModel* camDM = it.current()->dataModel(); + if ( camDM && camDM->inherits( "SalomeApp_DataModel" ) ) + ((SalomeApp_DataModel*)camDM)->update(); + } + } + if ( objectBrowser() ) + objectBrowser()->updateTree(); +} diff --git a/src/SalomeApp/SalomeApp_Application.h b/src/SalomeApp/SalomeApp_Application.h index c11878791..266ef4f0d 100644 --- a/src/SalomeApp/SalomeApp_Application.h +++ b/src/SalomeApp/SalomeApp_Application.h @@ -71,6 +71,8 @@ public: OB_Browser* objectBrowser(); PythonConsole* pythonConsole(); + virtual void updateObjectBrowser( const bool = true ); + SalomeApp_Preferences* preferences() const; virtual QString getFileFilter() const; -- 2.39.2