]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #684 Buttons "X"
authornds <nds@opencascade.com>
Fri, 11 Sep 2015 14:48:25 +0000 (17:48 +0300)
committernds <nds@opencascade.com>
Fri, 11 Sep 2015 14:48:54 +0000 (17:48 +0300)
Issue #956 Fatal error as result of action without OCC scene

src/ModuleBase/ModuleBase_WidgetValidated.cpp
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_SketcherMgr.cpp
src/XGUI/XGUI_OperationMgr.cpp
src/XGUI/XGUI_pictures.qrc
src/XGUI/pictures/button_plus.png [new file with mode: 0755]

index d549ac306130b108f731650513e1012abb392f57..c117e8ed003443b8ff316f4deb7b8f388c482465 100644 (file)
@@ -101,14 +101,17 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrs& th
     if (!isActivated)
       activateFilters(true);
 
-    const SelectMgr_ListOfFilter& aFilters = myWorkshop->viewer()->AISContext()->Filters();
-    SelectMgr_ListIteratorOfListOfFilter anIt(aFilters);
-    for (; anIt.More() && aValid; anIt.Next()) {
-      Handle(SelectMgr_Filter) aFilter = anIt.Value();
-      aValid = aFilter->IsOk(anOwner);
+    Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+    if (!aContext.IsNull()) {
+      const SelectMgr_ListOfFilter& aFilters = aContext->Filters();
+      SelectMgr_ListIteratorOfListOfFilter anIt(aFilters);
+      for (; anIt.More() && aValid; anIt.Next()) {
+        Handle(SelectMgr_Filter) aFilter = anIt.Value();
+        aValid = aFilter->IsOk(anOwner);
+      }
+      if (!isActivated)
+        activateFilters(false);
     }
-    if (!isActivated)
-      activateFilters(false);
   }
 
   // removes created owner
index f873be21aef48d0223df7d8e448db5492a06be7b..9cb9af831014ad92eeac84306e9204e413434219 100755 (executable)
@@ -809,6 +809,8 @@ void PartSet_Module::onViewTransformed(int theTrsfType)
   XGUI_Workshop* aWorkshop = aConnector->workshop();
   XGUI_Displayer* aDisplayer = aWorkshop->displayer();
   Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
+  if (aContext.IsNull())
+    return;
 
   Handle(V3d_Viewer) aV3dViewer = aContext->CurrentViewer();
   Handle(V3d_View) aView;
index 50d4cd86e9e2f504f8569285cfae94fa19197d4d..4a84b0cc1f5d45dd500ab2887a8e49beea51385c 100644 (file)
@@ -372,8 +372,11 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE
     if ((!isSketcher) && (!isEditing))
       return;
 
+    Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
+    if (aContext.IsNull())
+      return;
     // MoveTo in order to highlight current object
-    aViewer->AISContext()->MoveTo(theEvent->x(), theEvent->y(), theWnd->v3dView());
+    aContext->MoveTo(theEvent->x(), theEvent->y(), theWnd->v3dView());
 
     // Remember highlighted objects for editing
     ModuleBase_ISelection* aSelect = aWorkshop->selection();
@@ -438,13 +441,15 @@ void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouse
         if (myDragDone) {
           //aOp->commit();
           myCurrentSelection.clear();
+          /*Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
+          if (!aContext.IsNull()) {
           // Reselect edited object
-          /*aViewer->AISContext()->MoveTo(theEvent->x(), theEvent->y(), theWnd->v3dView());
+          aContext->MoveTo(theEvent->x(), theEvent->y(), theWnd->v3dView());
           if (theEvent->modifiers() & Qt::ShiftModifier)
-            aViewer->AISContext()->ShiftSelect();
+            aContext->ShiftSelect();
           else
-            aViewer->AISContext()->Select();
-            */
+            aContext->Select();
+          */
         }
       }
     }
@@ -909,6 +914,7 @@ void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* /* theOperation*/)
 void PartSet_SketcherMgr::startNestedSketch(ModuleBase_Operation* theOperation)
 {
   connectToPropertyPanel(true);
+  QApplication::setOverrideCursor(QCursor(QIcon(":pictures/button_plus.png").pixmap(20,20)));
 }
 
 void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOp)
@@ -917,6 +923,7 @@ void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOp)
   myIsResetCurrentValue = false;
   myIsMouseOverViewProcessed = true;
   operationMgr()->onValidateOperation();
+  QApplication::restoreOverrideCursor();
 }
 
 void PartSet_SketcherMgr::commitNestedSketch(ModuleBase_Operation* theOperation)
@@ -1093,6 +1100,8 @@ void PartSet_SketcherMgr::getCurrentSelection(const FeaturePtr& theFeature,
 
   ModuleBase_IViewer* aViewer = theWorkshop->viewer();
   Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
+  if (aContext.IsNull())
+    return;
   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(theWorkshop);
   XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
 
@@ -1141,6 +1150,9 @@ void PartSet_SketcherMgr::getSelectionOwners(const FeaturePtr& theFeature,
 
   ModuleBase_IViewer* aViewer = theWorkshop->viewer();
   Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
+  if (aContext.IsNull())
+    return;
+
   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(theWorkshop);
   XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
 
index 2382354ea57b469471d9588722e1b8e8f43f7d66..2d36b457593a9600dcfa37c0dbca6689b9216178 100644 (file)
@@ -438,11 +438,13 @@ bool XGUI_OperationMgr::onKeyReleased(QKeyEvent* theEvent)
       if (noModifiers) {
         ModuleBase_IViewer* aViewer = myWorkshop->viewer();
         Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
-        Handle(V3d_View) aView = aViewer->activeView();
-        if ((theEvent->key() == Qt::Key_N))
-          aContext->HilightNextDetected(aView);
-        else if ((theEvent->key() == Qt::Key_P))
-          aContext->HilightPreviousDetected(aView);
+        if (!aContext.IsNull()) {
+          Handle(V3d_View) aView = aViewer->activeView();
+          if ((theEvent->key() == Qt::Key_N))
+            aContext->HilightNextDetected(aView);
+          else if ((theEvent->key() == Qt::Key_P))
+            aContext->HilightPreviousDetected(aView);
+        }
       }
     }
 
index cda15df939097dadda6d42b691a6641b1187b8dc..192bb1c7e947f1d1b2b6532d4b85f13433c39b2d 100644 (file)
@@ -31,6 +31,7 @@
      <file>pictures/button_help.png</file>
      <file>pictures/button_ok.png</file>
      <file>pictures/button_ok_error.png</file>
+     <file>pictures/button_plus.png</file>
    
      <file>pictures/assembly.png</file>
      <file>pictures/delete.png</file>
diff --git a/src/XGUI/pictures/button_plus.png b/src/XGUI/pictures/button_plus.png
new file mode 100755 (executable)
index 0000000..c68d557
Binary files /dev/null and b/src/XGUI/pictures/button_plus.png differ