From 6d09e21537887c060b2efd7f77c1b41d82410f5c Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 18 Jan 2011 12:53:59 +0000 Subject: [PATCH] Fix a bug: when study is opened/loaded, only first component is restored in the data tree --- src/SalomeApp/SalomeApp_DataModel.cxx | 5 +---- src/SalomeApp/SalomeApp_Study.cxx | 4 ++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/SalomeApp/SalomeApp_DataModel.cxx b/src/SalomeApp/SalomeApp_DataModel.cxx index 5462099f2..f64cf4776 100644 --- a/src/SalomeApp/SalomeApp_DataModel.cxx +++ b/src/SalomeApp/SalomeApp_DataModel.cxx @@ -115,6 +115,7 @@ suitPtr SalomeApp_DataModelSync::createItem( const kerPtr& so, _PTR(SComponent) aSComp( so ); suitPtr nitem = aSComp ? new SalomeApp_ModuleObject( aSComp, 0 ) : new SalomeApp_DataObject( so, 0 ); + if( parent ) { int pos = after ? parent->childPos( after ) : 0; parent->insertChild( nitem, pos+1 ); @@ -364,10 +365,6 @@ SUIT_DataObject* SalomeApp_DataModel::synchronize( const _PTR( SComponent )& sob else suitObj= 0; -#ifdef WITH_SALOMEDS_OBSERVER - root->setToSynchronize(false); -#endif - return suitObj; } diff --git a/src/SalomeApp/SalomeApp_Study.cxx b/src/SalomeApp/SalomeApp_Study.cxx index f1e026db2..a2ecd56db 100644 --- a/src/SalomeApp/SalomeApp_Study.cxx +++ b/src/SalomeApp/SalomeApp_Study.cxx @@ -256,7 +256,9 @@ bool SalomeApp_Study::createDocument( const QString& theStr ) // create myRoot SalomeApp_RootObject* aRoot=new SalomeApp_RootObject( this ); +#ifdef WITH_SALOMEDS_OBSERVER aRoot->setToSynchronize(false); +#endif setRoot( aRoot ); bool aRet = CAM_Study::createDocument( theStr ); @@ -301,6 +303,7 @@ bool SalomeApp_Study::openDocument( const QString& theFileName ) ((SalomeApp_Application*)application())->updateObjectBrowser( false ); #ifdef WITH_SALOMEDS_OBSERVER + dynamic_cast( root() )->setToSynchronize(false); Observer_i* myObserver_i = new Observer_i(myStudyDS,this); //attach an observer to the study with notification of modifications myStudyDS->attach(myObserver_i->_this(),true); @@ -355,6 +358,7 @@ bool SalomeApp_Study::loadDocument( const QString& theStudyName ) ((SalomeApp_Application*)application())->updateObjectBrowser( false ); #ifdef WITH_SALOMEDS_OBSERVER + dynamic_cast( root() )->setToSynchronize(false); Observer_i* myObserver_i = new Observer_i(myStudyDS,this); //attach an observer to the study with notification of modifications myStudyDS->attach(myObserver_i->_this(),true); -- 2.39.2