From: nds Date: Fri, 11 Sep 2015 14:48:25 +0000 (+0300) Subject: Issue #684 Buttons "X" X-Git-Tag: V_1.4.0_beta4~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a2696ffe0fbfb1239518992d446fb42b0ce92efc;p=modules%2Fshaper.git Issue #684 Buttons "X" Issue #956 Fatal error as result of action without OCC scene --- diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.cpp b/src/ModuleBase/ModuleBase_WidgetValidated.cpp index d549ac306..c117e8ed0 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.cpp +++ b/src/ModuleBase/ModuleBase_WidgetValidated.cpp @@ -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 diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index f873be21a..9cb9af831 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -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; diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 50d4cd86e..4a84b0cc1 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -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(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(theWorkshop); XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index 2382354ea..2d36b4575 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -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); + } } } diff --git a/src/XGUI/XGUI_pictures.qrc b/src/XGUI/XGUI_pictures.qrc index cda15df93..192bb1c7e 100644 --- a/src/XGUI/XGUI_pictures.qrc +++ b/src/XGUI/XGUI_pictures.qrc @@ -31,6 +31,7 @@ pictures/button_help.png pictures/button_ok.png pictures/button_ok_error.png + pictures/button_plus.png pictures/assembly.png pictures/delete.png diff --git a/src/XGUI/pictures/button_plus.png b/src/XGUI/pictures/button_plus.png new file mode 100755 index 000000000..c68d557af Binary files /dev/null and b/src/XGUI/pictures/button_plus.png differ