aAction->setShortcut(Qt::Key_Delete);
aAction->setShortcutContext(Qt::ApplicationShortcut);
+ aAction = new QAction(QIcon(":pictures/rename_edit.png"), tr("Rename"), this);
+ addAction("RENAME_CMD", aAction);
+ connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onRename()));
+
aAction = new QAction(QIcon(":pictures/move.png"), tr("Move..."), this);
addAction("MOVE_CMD", aAction);
}
else if (hasFeature && myWorkshop->canMoveFeature())
action("MOVE_CMD")->setEnabled(true);
+
+ if( aMgr->activeDocument() == aObject->document() )
+ {
+ action("RENAME_CMD")->setEnabled(true);
+ action("DELETE_CMD")->setEnabled(true);
+ }
}
} else {
if (hasResult && (!hasParameter)) {
action("WIREFRAME_CMD")->setEnabled(true);
}
}
- if (!hasSubFeature) {
+ bool allActive = true;
+ foreach( ObjectPtr aObject, aObjects )
+ if( aMgr->activeDocument() != aObject->document() )
+ {
+ allActive = false;
+ break;
+ }
+ if (!hasSubFeature && allActive ) {
if (hasFeature || hasParameter)
action("DELETE_CMD")->setEnabled(true);
}
aList.append(action("HIDE_CMD"));
aList.append(action("SHOW_ONLY_CMD"));
aList.append(action("COLOR_CMD"));
+ aList.append(mySeparator);
+ aList.append(action("RENAME_CMD"));
myObjBrowserMenus[ModelAPI_ResultConstruction::group()] = aList;
//-------------------------------------
// Result body menu
aList.append(action("SHOW_CMD"));
aList.append(action("HIDE_CMD"));
aList.append(action("SHOW_ONLY_CMD"));
+ aList.append(mySeparator);
+ aList.append(action("RENAME_CMD"));
myObjBrowserMenus[ModelAPI_ResultBody::group()] = aList;
// Group menu
myObjBrowserMenus[ModelAPI_ResultGroup::group()] = aList;
aList.clear();
aList.append(action("DELETE_CMD"));
aList.append(action("MOVE_CMD"));
+ aList.append(mySeparator);
+ aList.append(action("RENAME_CMD"));
myObjBrowserMenus[ModelAPI_Feature::group()] = aList;
aList.clear();
aList.append(action("DELETE_CMD"));
+ aList.append(mySeparator);
+ aList.append(action("RENAME_CMD"));
myObjBrowserMenus[ModelAPI_ResultParameter::group()] = aList;
//-------------------------------------
}
}
return aGroups;
}
+
+void XGUI_ContextMenuMgr::onRename()
+{
+ myWorkshop->objectBrowser()->onEditItem();
+}
SLOT(onLabelContextMenuRequested(const QPoint&)));
connect(myTreeView, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this,
SLOT(onContextMenuRequested(QContextMenuEvent*)));
-
- // Create internal actions
- QAction* aAction = new QAction(QIcon(":pictures/rename_edit.png"), tr("Rename"), this);
- aAction->setData("RENAME_CMD");
- connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onEditItem()));
- addAction(aAction);
}
//***************************************************
/// Set Data Model for the Object Browser
void setDataModel(ModuleBase_IDocumentDataModel* theModel);
+public slots:
+ //! Called on Edit command request
+ void onEditItem();
+
signals:
//! Emited when selection is changed
void selectionChanged();
/// \param thePnt a position of context menu
void onLabelContextMenuRequested(const QPoint& thePnt);
- //! Called on Edit command request
- void onEditItem();
-
//! Called when selection in Data Tree is changed
void onSelectionChanged(const QItemSelection& theSelected, const QItemSelection& theDeselected);