From be09c684368616df2c25b95c2f4449264c08d481 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 26 May 2015 14:26:28 +0300 Subject: [PATCH] Issue #487: Creating a Sketch point at the origin --- src/PartSet/PartSet_WidgetPoint2d.cpp | 14 ++++++++++++++ src/PartSet/PartSet_WidgetPoint2d.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index a44b8c9ee..1bdd8dc03 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -213,6 +213,7 @@ void PartSet_WidgetPoint2D::activateCustom() this, SLOT(onMouseMove(ModuleBase_IViewWindow*, QMouseEvent*))); connect(aViewer, SIGNAL(mouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)), this, SLOT(onMouseRelease(ModuleBase_IViewWindow*, QMouseEvent*))); + connect(aViewer, SIGNAL(leaveViewPort()), this, SLOT(onLeaveViewPort())); QIntList aModes; aModes << TopAbs_VERTEX; @@ -227,6 +228,8 @@ void PartSet_WidgetPoint2D::deactivate() this, SLOT(onMouseMove(ModuleBase_IViewWindow*, QMouseEvent*))); disconnect(aViewer, SIGNAL(mouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)), this, SLOT(onMouseRelease(ModuleBase_IViewWindow*, QMouseEvent*))); + disconnect(aViewer, SIGNAL(leaveViewPort()), this, SLOT(onLeaveViewPort())); + myWorkshop->moduleConnector()->deactivateSubShapesSelection(); myWorkshop->operationMgr()->setLockValidating(false); } @@ -350,6 +353,17 @@ void PartSet_WidgetPoint2D::onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEv setPoint(aX, anY); } +void PartSet_WidgetPoint2D::onLeaveViewPort() +{ + // it is important to restore the validity state in the property panel after leaving the + // view port. Unlock the validating. + XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr(); + if (anOperationMgr->isValidationLocked()) { + anOperationMgr->setLockValidating(false); + anOperationMgr->onValidateOperation(); + } +} + double PartSet_WidgetPoint2D::x() const { return myXSpin->value(); diff --git a/src/PartSet/PartSet_WidgetPoint2d.h b/src/PartSet/PartSet_WidgetPoint2d.h index a2fe2aa8d..07e33c759 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.h +++ b/src/PartSet/PartSet_WidgetPoint2d.h @@ -106,6 +106,9 @@ protected slots: /// \param theEvent a mouse event void onMouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); + /// Process mouse leave view port to update validity state of the property panel + void onLeaveViewPort(); + protected: /// Saves the internal parameters to the given feature /// \return True in success -- 2.39.2