From: nds Date: Fri, 22 Jan 2016 09:07:43 +0000 (+0300) Subject: Delete key regression corrections: in previous implementation sketch entities did... X-Git-Tag: V_2.2.0~182 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ae8d4a42b1048fb3144c8c436019a86f734914f4;p=modules%2Fshaper.git Delete key regression corrections: in previous implementation sketch entities did not deleted by this key. --- diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index 939505967..a90353845 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -281,7 +281,9 @@ bool ModuleBase_ModelWidget::processEnter() bool ModuleBase_ModelWidget::processDelete() { - return false; + // we consider that model objects eats delete key in order to + // do nothing by for example symbol delete in line edit or spin box + return true; } bool ModuleBase_ModelWidget::eventFilter(QObject* theObject, QEvent *theEvent) diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index dc9c6ac54..47fa2a04f 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -823,15 +823,17 @@ ObjectPtr PartSet_Module::findPresentedObject(const AISObjectPtr& theAIS) const if (aOperation) { /// If last line finished on vertex the lines creation sequence has to be break ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel(); - ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget(); - // if there is an active widget, find the presented object in it - if (!anActiveWidget) - anActiveWidget = aPanel->preselectionWidget(); + if (aPanel) { + ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget(); + // if there is an active widget, find the presented object in it + if (!anActiveWidget) + anActiveWidget = aPanel->preselectionWidget(); - ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast - (anActiveWidget); - if (aWidgetValidated) - anObject = aWidgetValidated->findPresentedObject(theAIS); + ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast + (anActiveWidget); + if (aWidgetValidated) + anObject = aWidgetValidated->findPresentedObject(theAIS); + } } return anObject; } diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index f8879aa62..0f622a24c 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -631,12 +631,19 @@ bool XGUI_OperationMgr::onProcessDelete(QObject* theObject) ModuleBase_ModelWidget* anActiveWgt = 0; // firstly the widget should process Delete action ModuleBase_IPropertyPanel* aPanel; + bool isPPChildObject = false; if (aOperation) { aPanel = aOperation->propertyPanel(); - if (aPanel) - anActiveWgt = aPanel->activeWidget(); - if (anActiveWgt) { - isAccepted = anActiveWgt->processDelete(); + if (aPanel) { + isPPChildObject = isChildObject(theObject, aPanel); + // process delete in active widget only if delete sender is child of property panel + // it is necessary for the case when OB is shown, user perform selection and click Delete + if (isPPChildObject) { + anActiveWgt = aPanel->activeWidget(); + if (anActiveWgt) { + isAccepted = anActiveWgt->processDelete(); + } + } } } if (!isAccepted) { @@ -645,8 +652,10 @@ bool XGUI_OperationMgr::onProcessDelete(QObject* theObject) /// processing delete by workshop XGUI_ObjectsBrowser* aBrowser = workshop()->objectBrowser(); QWidget* aViewPort = myWorkshop->viewer()->activeViewPort(); + // property panel childe object is processed to process delete performed on Apply button of PP if (isChildObject(theObject, aBrowser) || - isChildObject(theObject, aViewPort)) + isChildObject(theObject, aViewPort) || + isPPChildObject) workshop()->deleteObjects(); isAccepted = true; }