aAction = new QAction(QIcon(":icons/edit.png"), tr("Edit..."), this);
connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onEdit(bool)));
myActions["EDIT_CMD"] = aAction;
+
+ aAction = new QAction(QIcon(), tr("Select parent feature"), this);
+ aAction->setCheckable(false);
+ connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onSelectParentFeature()));
+ myActions["SELECT_PARENT_CMD"] = aAction;
}
if (aFeature.get() != NULL)
myModule->editFeature(aFeature);
}
+
+void PartSet_MenuMgr::onSelectParentFeature()
+{
+ QObjectPtrList aObjects = myModule->workshop()->selection()->selectedObjects();
+ if (aObjects.size() != 1)
+ return;
+
+ SessionPtr aMgr = ModelAPI_Session::get();
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>( aObjects.first() );
+ if( !aResult.get() )
+ return;
+
+ FeaturePtr aParentFeature = aResult->document()->feature( aResult );
+ QObjectPtrList aSelection;
+ aSelection.append( aParentFeature );
+ myModule->workshop()->selection()->setSelectedObjects( aSelection );
+}
/// A slot called on edit of feature
void onEdit(bool);
+ void onSelectParentFeature();
+
private:
/// Returns true if the current operation is sketch entity create operation
/// \param theValue the current auxiliary value
if (hasParameter || hasFeature)
theMenu->addAction(myMenuMgr->action("EDIT_CMD"));
}
+
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObject);
+ if( aResult.get() )
+ {
+ theMenu->addAction(myMenuMgr->action("SELECT_PARENT_CMD"));
+ }
} else { // If feature is 0 the it means that selected root object (document)
if (aMgr->activeDocument() != aMgr->moduleDocument())
theMenu->addAction(myMenuMgr->action("ACTIVATE_PARTSET_CMD"));
return myWorkshop->objectBrowser()->selectedObjects();
}
+void XGUI_Selection::setSelectedObjects( const QObjectPtrList& theObjects ) const
+{
+ return myWorkshop->objectBrowser()->setObjectsSelected( theObjects );
+}
+
QObjectPtrList XGUI_Selection::selectedPresentations() const
{
QObjectPtrList aSelectedList;