void PartSet_MenuMgr::onEdit(bool)
{
QObjectPtrList aObjects = myModule->workshop()->selection()->selectedObjects();
- FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObjects.first());
- if (aFeature == NULL) {
- ResultParameterPtr aParam =
- std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aObjects.first());
- if (aParam.get() != NULL) {
- aFeature = ModelAPI_Feature::feature(aParam);
+ FeaturePtr aFeature;
+ foreach(ObjectPtr aObj, aObjects) {
+ aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+ if (aFeature.get())
+ break;
+ }
+ if (aFeature.get() == NULL) {
+ ResultParameterPtr aParam;
+ foreach(ObjectPtr aObj, aObjects) {
+ aParam = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aObj);
+ if (aParam.get())
+ break;
}
+ if (aParam.get() != NULL)
+ aFeature = ModelAPI_Feature::feature(aParam);
}
if (aFeature.get() != NULL)
myModule->editFeature(aFeature);
SessionPtr aMgr = ModelAPI_Session::get();
QAction* aActivatePartAction = myMenuMgr->action("ACTIVATE_PART_CMD");
+ bool hasResult = false;
+ bool hasFeature = false;
+ bool hasParameter = false;
+ bool hasCompositeOwner = false;
+ ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter,
+ hasCompositeOwner);
+
ModuleBase_Operation* aCurrentOp = myWorkshop->currentOperation();
if (aSelected == 1) {
- bool hasResult = false;
- bool hasFeature = false;
- bool hasParameter = false;
- bool hasCompositeOwner = false;
- ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter,
- hasCompositeOwner);
ObjectPtr aObject = aObjects.first();
if (aObject) {
ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
}
}
}
+ } else {
+ if (hasFeature) {
+ myMenuMgr->action("EDIT_CMD")->setEnabled(aCurrentOp == 0);
+ theMenu->addAction(myMenuMgr->action("EDIT_CMD"));
+ theMenu->addSeparator();
+ }
}
bool aNotDeactivate = (aCurrentOp == 0);
if (!aNotDeactivate) {