From 84468a9b2264ea713ada76b0db9e685f24d02d5b Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 27 Mar 2020 15:51:16 +0300 Subject: [PATCH] Issue #18905(tuleap): Restore old plane of sketcher if user cancels plane change --- src/PartSet/PartSet_WidgetSketchLabel.cpp | 10 ++++++++++ src/PartSet/PartSet_WidgetSketchLabel.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index 577689a6c..099f6800b 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -332,6 +332,10 @@ bool PartSet_WidgetSketchLabel::setSelectionInternal( void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrsPtr& thePrs) { + // Nullify a temporary remembered plane + if (myTmpPlane.get()) + myTmpPlane.reset(); + GeomPlanePtr aPlane = plane(); if (!aPlane.get()) return; @@ -613,6 +617,11 @@ void PartSet_WidgetSketchLabel::onShowPanel() void PartSet_WidgetSketchLabel::deactivate() { + if (myTmpPlane.get()) { + setSketchPlane(myTmpPlane); + myTmpPlane.reset(); + } + ModuleBase_WidgetValidated::deactivate(); bool aHidePreview = myPreviewPlanes->isPreviewDisplayed(); myPreviewPlanes->erasePreviewPlanes(myWorkshop); @@ -774,6 +783,7 @@ void PartSet_WidgetSketchLabel::onChangePlane() } CompositeFeaturePtr aSketch = std::dynamic_pointer_cast(myFeature); + myTmpPlane = PartSet_Tools::sketchPlane(aSketch); PartSet_Tools::nullifySketchPlane(aSketch); Handle(SelectMgr_Filter) aFilter = aModule->selectionFilter(SF_SketchPlaneFilter); diff --git a/src/PartSet/PartSet_WidgetSketchLabel.h b/src/PartSet/PartSet_WidgetSketchLabel.h index ba5c2bb50..64dbdb817 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.h +++ b/src/PartSet/PartSet_WidgetSketchLabel.h @@ -258,6 +258,8 @@ private: QDialog* myPartSetMessage; QDialog* mySizeMessage; + + GeomPlanePtr myTmpPlane; }; #endif -- 2.39.2