]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Delete key regression corrections: in previous implementation sketch entities did...
authornds <nds@opencascade.com>
Fri, 22 Jan 2016 09:07:43 +0000 (12:07 +0300)
committernds <nds@opencascade.com>
Fri, 22 Jan 2016 09:07:43 +0000 (12:07 +0300)
src/ModuleBase/ModuleBase_ModelWidget.cpp
src/PartSet/PartSet_Module.cpp
src/XGUI/XGUI_OperationMgr.cpp

index 939505967552215db2fd1982170c7efe27772e34..a903538452c4c03ca7741b53368a53ee8aa4eb4a 100644 (file)
@@ -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)
index dc9c6ac54fe9cb918d1c71b6a89e90a40c93e98b..47fa2a04f5d5d5f71da9630ad4c7816bfcef7306 100755 (executable)
@@ -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<ModuleBase_WidgetValidated*>
-                                                                           (anActiveWidget);
-    if (aWidgetValidated)
-      anObject = aWidgetValidated->findPresentedObject(theAIS);
+      ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
+                                                                             (anActiveWidget);
+      if (aWidgetValidated)
+        anObject = aWidgetValidated->findPresentedObject(theAIS);
+    }
   }
   return anObject;
 }
index f8879aa62eddfcff893e0f493d11218a527c1751..0f622a24c327a147c22c7493ce3abecb52a6d67d 100644 (file)
@@ -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;
   }