From 971cfb94452c33c14e186705588e24995bf38217 Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 22 Dec 2014 18:59:28 +0300 Subject: [PATCH] Provide editing flag for widgets --- src/ModuleBase/ModuleBase_IPropertyPanel.h | 2 +- src/ModuleBase/ModuleBase_ModelWidget.h | 6 ++++++ src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp | 13 ------------- src/PartSet/PartSet_WidgetPoint2d.cpp | 2 ++ src/XGUI/XGUI_PropertyPanel.cpp | 8 +++++++- src/XGUI/XGUI_PropertyPanel.h | 10 +++------- 6 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/ModuleBase/ModuleBase_IPropertyPanel.h b/src/ModuleBase/ModuleBase_IPropertyPanel.h index fdac20d13..77b65f2d6 100644 --- a/src/ModuleBase/ModuleBase_IPropertyPanel.h +++ b/src/ModuleBase/ModuleBase_IPropertyPanel.h @@ -30,7 +30,7 @@ public: virtual const QList& modelWidgets() const = 0; /// Editing mode depends on mode of current operation. This value is defined by it. - void setEditingMode(bool isEditing) { myIsEditing = isEditing; } + virtual void setEditingMode(bool isEditing) { myIsEditing = isEditing; } bool isEditingMode() const { return myIsEditing; } /// Set Enable/Disable state of Ok button diff --git a/src/ModuleBase/ModuleBase_ModelWidget.h b/src/ModuleBase/ModuleBase_ModelWidget.h index e2f234384..15a0c5b2a 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.h +++ b/src/ModuleBase/ModuleBase_ModelWidget.h @@ -123,6 +123,10 @@ Q_OBJECT myFeature = theFeature; } + /// Editing mode depends on mode of current operation. This value is defined by it. + void setEditingMode(bool isEditing) { myIsEditing = isEditing; } + bool isEditingMode() const { return myIsEditing; } + signals: /// The signal about widget values changed void valuesChanged(); @@ -155,6 +159,8 @@ signals: bool myIsComputedDefault; /// Value should be computed on execute, /// like radius for circle's constraint (can not be zero) + + bool myIsEditing; }; #endif diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp index 73f1f9057..ba0f248af 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp @@ -444,19 +444,6 @@ void ModuleBase_WidgetShapeSelector::raisePanel() const } } -//******************************************************************** -//bool ModuleBase_WidgetShapeSelector::setSelection(ModuleBase_ViewerPrs theValue) -//{ -// if (theValue.object()) { -// ObjectPtr aObject = theValue.object(); -// if (acceptObjectShape(aObject)) { -// setObject(aObject); -// return true; -// } -// } -// return false; -//} - //******************************************************************** void ModuleBase_WidgetShapeSelector::activate() { diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index 8079d4885..ad30fc248 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -256,6 +256,8 @@ void PartSet_WidgetPoint2D::onMouseRelease(ModuleBase_IViewWindow* theWnd, QMous void PartSet_WidgetPoint2D::onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) { + if (isEditingMode()) + return; myWorkshop->operationMgr()->setLockValidating(true); myWorkshop->propertyPanel()->setOkEnabled(false); diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index c3d200d41..2249d12a0 100644 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -246,4 +246,10 @@ bool XGUI_PropertyPanel::isCancelEnabled() const return anCancelBtn->isEnabled(); } - +void XGUI_PropertyPanel::setEditingMode(bool isEditing) +{ + ModuleBase_IPropertyPanel::setEditingMode(isEditing); + foreach(ModuleBase_ModelWidget* aWgt, myWidgets) { + aWgt->setEditingMode(isEditing); + } +} diff --git a/src/XGUI/XGUI_PropertyPanel.h b/src/XGUI/XGUI_PropertyPanel.h index 071779431..1bd6e71be 100644 --- a/src/XGUI/XGUI_PropertyPanel.h +++ b/src/XGUI/XGUI_PropertyPanel.h @@ -71,6 +71,9 @@ Q_OBJECT /// Returns state of Ok button virtual bool isCancelEnabled() const; + /// Editing mode depends on mode of current operation. This value is defined by it. + virtual void setEditingMode(bool isEditing); + public slots: void updateContentWidget(FeaturePtr theFeature); // Enables / disables "ok" ("accept") button @@ -81,13 +84,6 @@ Q_OBJECT // emits widgetActivated(theWidget) signal virtual void activateWidget(ModuleBase_ModelWidget* theWidget); - signals: - /// Signal about the point 2d set to the feature - /// \param the feature - /// \param the attribute of the feature - //void storedPoint2D(ObjectPtr theFeature, const std::string& theAttribute); - - private: QWidget* myCustomWidget; QList myWidgets; -- 2.39.2