XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
connect(anOpMgr, SIGNAL(keyEnterReleased()), this, SLOT(onEnterReleased()));
+ connect(anOpMgr, SIGNAL(keyDeleteReleased()), this, SLOT(onDeleteObjects()));
connect(anOpMgr, SIGNAL(operationActivatedByPreselection()),
this, SLOT(onOperationActivatedByPreselection()));
myRestartingMode = RM_EmptyFeatureUsed;
}
+void PartSet_Module::onDeleteObjects()
+{
+ ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
+ if (PartSet_SketcherMgr::isSketchOperation(anOperation) ||
+ PartSet_SketcherMgr::isNestedSketchOperation(anOperation))
+ deleteObjects();
+}
+
void PartSet_Module::onOperationActivatedByPreselection()
{
ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
/// It commits the operation of it is can be committed
void onOperationActivatedByPreselection();
+ //! Delete features
+ void onDeleteObjects();
protected:
/// Register validators for this module
addAction("DEACTIVATE_PART_CMD", aAction);
aAction = new QAction(QIcon(":pictures/delete.png"), tr("Delete"), this);
+ myWorkshop->mainWindow()->addAction(aAction);
addAction("DELETE_CMD", aAction);
+ aAction->setShortcut(Qt::Key_Delete);
+ aAction->setShortcutContext(Qt::ApplicationShortcut);
aAction = new QAction(QIcon(":pictures/eye_pencil.png"), tr("Show"), this);
addAction("SHOW_CMD", aAction);
emit keyEnterReleased();
commitOperation();
}
- break;
+ break;
+ case Qt::Key_Delete: { // the delete button is occupied by the workshop Delete action,
+ // so this button process is realized here
+ emit keyDeleteReleased();
+ }
default:
isAccepted = false;
break;
/// Signal is emitted after the key released click.
void keyEnterReleased();
+ /// Signal is emitted after the key delete released click.
+ void keyDeleteReleased();
protected:
/// Commits the current operatin if it is valid
//**************************************************************
void XGUI_Workshop::deleteObjects(const QObjectPtrList& theList)
{
- QMainWindow* aDesktop = isSalomeMode() ? salomeConnector()->desktop() : myMainWindow;
+ if (!isActiveOperationAborted())
+ return;
+ QMainWindow* aDesktop = isSalomeMode() ? salomeConnector()->desktop() : myMainWindow;
std::set<FeaturePtr> aRefFeatures;
foreach (ObjectPtr aObj, theList)
{