X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_Workshop.cpp;h=577e6decae9422acb5def9a2c2e92719452320aa;hb=009748938269b60a5195a288513092b25b09e8d9;hp=b0db00ee93d8df6efc5adafbea20916a801c88f0;hpb=bb65863adf6a3887d3bd70748bfcfd51eaaa7f51;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index b0db00ee9..577e6deca 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -79,7 +79,6 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector) myDisplayer = new XGUI_Displayer(this); mySelector = new XGUI_SelectionMgr(this); - connect(mySelector, SIGNAL(selectionChanged()), this, SLOT(changeCurrentDocument())); myOperationMgr = new XGUI_OperationMgr(this); myActionsMgr = new XGUI_ActionsMgr(this); @@ -602,6 +601,7 @@ QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent) aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); aObjDock->setWindowTitle(tr("Object browser")); myObjectBrowser = new XGUI_ObjectsBrowser(aObjDock); + connect(myObjectBrowser, SIGNAL(activePartChanged(FeaturePtr)), this, SLOT(changeCurrentDocument(FeaturePtr))); aObjDock->setWidget(myObjectBrowser); return aObjDock; } @@ -667,18 +667,15 @@ void XGUI_Workshop::onFeatureTriggered() } //****************************************************** -void XGUI_Workshop::changeCurrentDocument() +void XGUI_Workshop::changeCurrentDocument(FeaturePtr thePart) { - QFeatureList aFeatures = objectBrowser()->selectedFeatures(); - - // Set current document - if (aFeatures.size() > 0) { - FeaturePtr aFeature = aFeatures.first(); - - boost::shared_ptr aMgr = ModelAPI_PluginManager::get(); - boost::shared_ptr aDocRef = aFeature->data()->docRef("PartDocument"); + boost::shared_ptr aMgr = ModelAPI_PluginManager::get(); + if (thePart) { + boost::shared_ptr aDocRef = thePart->data()->docRef("PartDocument"); if (aDocRef) aMgr->setCurrentDocument(aDocRef->value()); + } else { + aMgr->setCurrentDocument(aMgr->rootDocument()); } }