From: nds Date: Thu, 29 Jan 2015 15:21:31 +0000 (+0300) Subject: default values for the constraint point in order to enable the "Apply" button X-Git-Tag: V_1.0.0~13^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e5b2e13f8b3609856b888ad53c3cdcbb9f47cf6b;p=modules%2Fshaper.git default values for the constraint point in order to enable the "Apply" button --- diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index 6a5421549..73a422d94 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -85,6 +85,17 @@ bool ModuleBase_ModelWidget::focusTo() return true; } +void ModuleBase_ModelWidget::activate() +{ + if (!isEditingMode()) { + // the control value is stored to the mode by the focus in on the widget + // we need the value is initialized in order to enable the apply button in the property panel + // it should happens only in the creation mode because during edition all fields are filled + storeValue(); + } + activateCustom(); +} + void ModuleBase_ModelWidget::updateObject(ObjectPtr theObj) const { Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); diff --git a/src/ModuleBase/ModuleBase_ModelWidget.h b/src/ModuleBase/ModuleBase_ModelWidget.h index bb11733d9..44b43e462 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.h +++ b/src/ModuleBase/ModuleBase_ModelWidget.h @@ -84,7 +84,7 @@ Q_OBJECT virtual bool focusTo(); /// The methiod called when widget is activated - virtual void activate() {} + void activate(); /// The methiod called when widget is deactivated virtual void deactivate() {} @@ -162,6 +162,9 @@ signals: myAttributeID = theAttribute; } + /// The methiod called when widget is activated + virtual void activateCustom() {}; + /// Sends Update and Redisplay for the given object /// \param theObj is updating object void updateObject(ObjectPtr theObj) const; diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp index 361f6383d..070cec76c 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp @@ -454,7 +454,7 @@ void ModuleBase_WidgetShapeSelector::raisePanel() const } //******************************************************************** -void ModuleBase_WidgetShapeSelector::activate() +void ModuleBase_WidgetShapeSelector::activateCustom() { activateSelection(true); } diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.h b/src/ModuleBase/ModuleBase_WidgetShapeSelector.h index c6b5431d0..b4885d240 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.h @@ -102,9 +102,6 @@ Q_OBJECT virtual bool setSelection(ModuleBase_ViewerPrs theValue); - /// The methiod called when widget is activated - virtual void activate(); - /// The methiod called when widget is deactivated virtual void deactivate(); @@ -119,7 +116,10 @@ Q_OBJECT void onSelectionChanged(); protected: - /// Computes and updates name of selected object in the widget + /// The methiod called when widget is activated + virtual void activateCustom(); + + /// Computes and updates name of selected object in the widget void updateSelectionName(); /// Raise panel which contains this widget diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index a8cd1a823..e8796669b 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -188,7 +188,7 @@ QList PartSet_WidgetPoint2D::getControls() const } -void PartSet_WidgetPoint2D::activate() +void PartSet_WidgetPoint2D::activateCustom() { XGUI_ViewerProxy* aViewer = myWorkshop->viewer(); connect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow*, QMouseEvent*)), @@ -199,12 +199,6 @@ void PartSet_WidgetPoint2D::activate() QIntList aModes; aModes << TopAbs_VERTEX; myWorkshop->moduleConnector()->activateSubShapesSelection(aModes); - if (!isEditingMode()) { - // the control value is stored to the mode by the focus in on the widget - // we need the value is initialized in order to enable the apply button in the property panel - // it should happens only in the creation mode because during edition all fields are filled - storeValue(); - } } void PartSet_WidgetPoint2D::deactivate() diff --git a/src/PartSet/PartSet_WidgetPoint2d.h b/src/PartSet/PartSet_WidgetPoint2d.h index bb5006963..def3b2bb7 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.h +++ b/src/PartSet/PartSet_WidgetPoint2d.h @@ -66,9 +66,6 @@ Q_OBJECT //bool initFromPrevious(ObjectPtr theObject); - /// The methiod called when widget is activated - virtual void activate(); - /// The methiod called when widget is deactivated virtual void deactivate(); @@ -111,6 +108,10 @@ protected slots: /// \param theEvent a mouse event void onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); +protected: + /// The methiod called when widget is activated + virtual void activateCustom(); + private slots: /// Process value changed event void onValuesChanged(); diff --git a/src/PartSet/PartSet_WidgetPoint2dDistance.cpp b/src/PartSet/PartSet_WidgetPoint2dDistance.cpp index c3cba967b..be1081034 100644 --- a/src/PartSet/PartSet_WidgetPoint2dDistance.cpp +++ b/src/PartSet/PartSet_WidgetPoint2dDistance.cpp @@ -60,7 +60,7 @@ void PartSet_WidgetPoint2dDistance::setPoint(FeaturePtr theFeature, } } -void PartSet_WidgetPoint2dDistance::activate() +void PartSet_WidgetPoint2dDistance::activateCustom() { XGUI_ViewerProxy* aViewer = myWorkshop->viewer(); connect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow*, QMouseEvent*)), diff --git a/src/PartSet/PartSet_WidgetPoint2dDistance.h b/src/PartSet/PartSet_WidgetPoint2dDistance.h index 9ccf0cb6b..aa0ce98cd 100644 --- a/src/PartSet/PartSet_WidgetPoint2dDistance.h +++ b/src/PartSet/PartSet_WidgetPoint2dDistance.h @@ -47,9 +47,6 @@ Q_OBJECT virtual ~PartSet_WidgetPoint2dDistance(); - /// The methiod called when widget is activated - virtual void activate(); - /// The methiod called when widget is deactivated virtual void deactivate(); @@ -78,6 +75,9 @@ Q_OBJECT void onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); protected: + /// The methiod called when widget is activated + virtual void activateCustom(); + /// Set the second point which defines a value in the widget as a distance with a first point defined by feature void setPoint(FeaturePtr theFeature, const std::shared_ptr& thePnt); diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index bf4810864..afe12cd2d 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -131,7 +131,7 @@ std::shared_ptr PartSet_WidgetSketchLabel::plane() const } -void PartSet_WidgetSketchLabel::activate() +void PartSet_WidgetSketchLabel::activateCustom() { std::shared_ptr aPlane = plane(); if (aPlane) { diff --git a/src/PartSet/PartSet_WidgetSketchLabel.h b/src/PartSet/PartSet_WidgetSketchLabel.h index 26364b8fc..9c9ffad2c 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.h +++ b/src/PartSet/PartSet_WidgetSketchLabel.h @@ -58,9 +58,6 @@ Q_OBJECT QWidget* getControl() const; - /// The methiod called when widget is activated - virtual void activate(); - /// The methiod called when widget is deactivated virtual void deactivate(); @@ -78,6 +75,10 @@ signals: /// Signal on plane selection void planeSelected(const std::shared_ptr& thePln); +protected: + /// The methiod called when widget is activated + virtual void activateCustom(); + private slots: /// Slot on plane selection void onPlaneSelected(); diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index 859c0da92..fa74ed503 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -13,7 +13,7 @@ #include XGUI_OperationMgr::XGUI_OperationMgr(QObject* theParent) - : QObject(theParent), myIsValidationLock(false) + : QObject(theParent), myIsValidationLock(false), myIsApplyEnabled(false) { }