X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_ObjectsBrowser.cpp;h=4268115fde4477d1bbe52412c4d440a4ca291c04;hb=4fcd5da2d972334e887716499b0ea75d9d6c51c2;hp=c128f3235d88ab3400f19b6facd8054faae04f77;hpb=428673f6b49a1997bf97ebbe5e00501c76439c20;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_ObjectsBrowser.cpp b/src/XGUI/XGUI_ObjectsBrowser.cpp index c128f3235..4268115fd 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.cpp +++ b/src/XGUI/XGUI_ObjectsBrowser.cpp @@ -57,16 +57,10 @@ void XGUI_DataTree::mouseDoubleClickEvent(QMouseEvent* theEvent) if (theEvent->button() == Qt::LeftButton) { QModelIndex aIndex = currentIndex(); XGUI_DocumentDataModel* aModel = dataModel(); - - if ((aModel->activePartIndex() != aIndex) && aModel->activePartIndex().isValid()) { - setExpanded(aModel->activePartIndex(), false); - } - bool isChanged = aModel->activatedIndex(aIndex); - QTreeView::mouseDoubleClickEvent(theEvent); - if (isChanged) { - if (aModel->activePartIndex().isValid()) - setExpanded(aIndex, true); - emit activePartChanged(aModel->activePart()); + ObjectPtr aObject = aModel->object(aIndex); + ResultPartPtr aPart = boost::dynamic_pointer_cast(aObject); + if (aPart) { + aPart->activate(); } } else QTreeView::mouseDoubleClickEvent(theEvent); @@ -84,9 +78,9 @@ void XGUI_DataTree::commitData(QWidget* theEditor) QString aRes = aEditor->text(); ObjectPtr aFeature = mySelectedData.first(); SessionPtr aMgr = ModelAPI_Session::get(); - aMgr->rootDocument()->startOperation(); + aMgr->startOperation(); aFeature->data()->setName(qPrintable(aRes)); - aMgr->rootDocument()->finishOperation(); + aMgr->finishOperation(); } } @@ -120,7 +114,7 @@ XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent) aLabelLay->addWidget(aLbl); SessionPtr aMgr = ModelAPI_Session::get(); - DocumentPtr aDoc = aMgr->rootDocument(); + DocumentPtr aDoc = aMgr->moduleDocument(); // TODO: Find a name of the root document myActiveDocLbl = new QLineEdit(tr("Part set"), aLabelWgt); @@ -227,7 +221,7 @@ void XGUI_ObjectsBrowser::closeDocNameEditing(bool toSave) if (toSave) { // TODO: Save the name of root document SessionPtr aMgr = ModelAPI_Session::get(); - DocumentPtr aDoc = aMgr->rootDocument(); + DocumentPtr aDoc = aMgr->moduleDocument(); } else { myActiveDocLbl->setText(myActiveDocLbl->property("OldText").toString()); } @@ -266,7 +260,7 @@ void XGUI_ObjectsBrowser::activatePart(const ResultPartPtr& thePart) void XGUI_ObjectsBrowser::onContextMenuRequested(QContextMenuEvent* theEvent) { myObjectsList = myTreeView->selectedObjects(); - bool toEnable = myObjectsList.size() > 0; + bool toEnable = myObjectsList.size() == 1; foreach(QAction* aCmd, actions()) { aCmd->setEnabled(toEnable); @@ -348,3 +342,9 @@ void XGUI_ObjectsBrowser::setObjectsSelected(const QList& theObjects) } } } + +//*************************************************** +void XGUI_ObjectsBrowser::processEvent(const boost::shared_ptr& theMessage) +{ + myDocModel->processEvent(theMessage); +}