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()));
XGUI_Workshop* aWorkshop = aConnector->workshop();
QAction* anAction = aWorkshop->contextMenuMgr()->action("DELETE_CMD");
theMenu->addAction(anAction);
- //theMenu->addAction(action("DELETE_PARTSET_CMD"));
}
}
bool isConstruction;
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();
{
QAction* anAction;
- //anAction = new QAction(QIcon(":pictures/delete.png"), tr("Delete"), this);
- //addAction("DELETE_PARTSET_CMD", anAction);
-
anAction = new QAction(tr("Construction"), this);
anAction->setCheckable(true);
addAction("CONSTRUCTION_CMD", anAction);
QAction* aAction = static_cast<QAction*>(sender());
QString anId = aAction->data().toString();
- //if (anId == "DELETE_PARTSET_CMD") {
- // deleteObjects();
- //}
if (anId == "CONSTRUCTION_CMD") {
mySketchMgr->setConstruction(isChecked);
}
}
-void PartSet_Module::deleteObjects()
+bool PartSet_Module::deleteObjects()
{
ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation);
if (!isSketchOp && !PartSet_SketcherMgr::isNestedSketchOperation(anOperation))
- return;
+ return false;
// sketch feature should be skipped, only sub-features can be removed
// when sketch operation is active
ModuleBase_ISelection* aSel = aConnector->selection();
QObjectPtrList aSelectedObj = aSel->selectedPresentations();
+ // if there are no selected objects in the viewer, that means that the selection in another
+ // place cased this method. It is necessary to return the false value to understande in above
+ // method that delete is not processed
+ if (aSelectedObj.count() == 0)
+ return false;
+
XGUI_Workshop* aWorkshop = aConnector->workshop();
XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
if (!isSketchOp && anOpMgr->canStopOperation()) {
aWorkshop->displayer()->updateViewer();
//myDisplayer->updateViewer();
aMgr->finishOperation();
+
+ return true;
}