]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Apply button to be disabled during value modification for any operation, not only...
authornds <nds@opencascade.com>
Fri, 16 Oct 2015 06:12:05 +0000 (09:12 +0300)
committernds <nds@opencascade.com>
Mon, 2 Nov 2015 09:44:20 +0000 (12:44 +0300)
src/ModuleBase/ModuleBase_IModule.h [changed mode: 0644->0755]
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_SketcherMgr.h
src/XGUI/XGUI_Workshop.cpp [changed mode: 0644->0755]
src/XGUI/XGUI_Workshop.h [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 78e68b5..ed5ad04
@@ -191,6 +191,11 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
   /// Returns list of granted operation indices\r
   virtual void grantedOperationIds(ModuleBase_Operation* theOperation, QStringList& theIds) const;\r
 \r
+  /// Connects or disconnects to the value changed signal of the property panel widgets\r
+  /// \param theWidget a property contol widget\r
+  /// \param isToConnect a boolean value whether connect or disconnect\r
+  virtual void connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect) {};\r
+\r
 signals:\r
   /// Signal which is emitted when operation is launched\r
   void operationLaunched();\r
index ce68a0c8d21d31d68ef592cfa6cc2774af8c2255..3ff904eab5d669817fc5ea62fa054423939acd13 100755 (executable)
@@ -246,6 +246,11 @@ void PartSet_Module::registerProperties()
                                    Config_Prop::Integer, SKETCH_WIDTH);
 }
 
+void PartSet_Module::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect)
+{
+  mySketchMgr->connectToPropertyPanel(theWidget, isToConnect);
+}
+
 void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation) 
 {
   if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
index 3ff88e6c64cba54da9c56c97416c4ac3d0f32fb7..06241521fed7a0e8dba8bddb9a06ac902e3bdf6b 100644 (file)
@@ -257,6 +257,11 @@ protected slots:
   /// Register properties of this module
   virtual void registerProperties();
 
+  /// Connects or disconnects to the value changed signal of the property panel widgets
+  /// \param theWidget a property contol widget
+  /// \param isToConnect a boolean value whether connect or disconnect
+  virtual void connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect);
+
  private slots:
    /// Processing of vertex selected
    void onVertexSelected();
index 60e578113fe61aeda1eb25af564537a073661eaa..9ea9e0596011308bf5d8ce7742751347ea32e402 100755 (executable)
@@ -265,13 +265,6 @@ void PartSet_SketcherMgr::onLeaveViewPort()
   }
 }
 
-void PartSet_SketcherMgr::onValueStateChanged()
-{
-  ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
-  if (anActiveWidget && anActiveWidget->getValueState() != ModuleBase_ModelWidget::Stored)
-    operationMgr()->onValidateOperation();
-}
-
 void PartSet_SketcherMgr::onBeforeValuesChangedInPropertyPanel()
 {
   if (isNestedCreateOperation(getCurrentOperation()))
@@ -918,14 +911,12 @@ void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation)
 
 void PartSet_SketcherMgr::startNestedSketch(ModuleBase_Operation* theOperation)
 {
-  connectToPropertyPanel(true);
   if (isNestedCreateOperation(theOperation) && myIsMouseOverWindow)
     QApplication::setOverrideCursor(QCursor(Qt::CrossCursor));//QIcon(":pictures/button_plus.png").pixmap(20,20)));
 }
 
 void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOp)
 {
-  connectToPropertyPanel(false);
   myIsMouseOverViewProcessed = true;
   operationMgr()->onValidateOperation();
   if (isNestedCreateOperation(theOp))
@@ -1200,32 +1191,21 @@ void PartSet_SketcherMgr::getSelectionOwners(const FeaturePtr& theFeature,
   }
 }
 
-void PartSet_SketcherMgr::connectToPropertyPanel(const bool isToConnect)
+void PartSet_SketcherMgr::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect)
 {
-  ModuleBase_IWorkshop* anIWorkshop = myModule->workshop();
-  XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(anIWorkshop);
-  XGUI_Workshop* aWorkshop = aConnector->workshop();
-  XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel();
-  if (aPropertyPanel) {
-    const QList<ModuleBase_ModelWidget*>& aWidgets = aPropertyPanel->modelWidgets();
-    foreach (ModuleBase_ModelWidget* aWidget, aWidgets) {
-      if (isToConnect) {
-        connect(aWidget, SIGNAL(beforeValuesChanged()),
+  if (isToConnect) {
+    connect(theWidget, SIGNAL(beforeValuesChanged()),
+            this, SLOT(onBeforeValuesChangedInPropertyPanel()));
+    connect(theWidget, SIGNAL(valuesChanged()), this, SLOT(onValuesChangedInPropertyPanel()));
+    connect(theWidget, SIGNAL(afterValuesChanged()),
+            this, SLOT(onAfterValuesChangedInPropertyPanel()));
+  }
+  else {
+    disconnect(theWidget, SIGNAL(beforeValuesChanged()),
                 this, SLOT(onBeforeValuesChangedInPropertyPanel()));
-        connect(aWidget, SIGNAL(valueStateChanged()),
-                this, SLOT(onValueStateChanged()));
-        connect(aWidget, SIGNAL(valuesChanged()), this, SLOT(onValuesChangedInPropertyPanel()));
-        connect(aWidget, SIGNAL(afterValuesChanged()),
+    disconnect(theWidget, SIGNAL(valuesChanged()), this, SLOT(onValuesChangedInPropertyPanel()));
+    disconnect(theWidget, SIGNAL(afterValuesChanged()),
                 this, SLOT(onAfterValuesChangedInPropertyPanel()));
-      }
-      else {
-        disconnect(aWidget, SIGNAL(beforeValuesChanged()),
-                   this, SLOT(onBeforeValuesChangedInPropertyPanel()));
-        disconnect(aWidget, SIGNAL(valuesChanged()), this, SLOT(onValuesChangedInPropertyPanel()));
-        disconnect(aWidget, SIGNAL(afterValuesChanged()),
-                   this, SLOT(onAfterValuesChangedInPropertyPanel()));
-      }
-    }
   }
 }
 
index d2a5226ed2a18e3c6be5f0ccb691ea7b58f05aef..3ea2f1fbf1069379fb852afca7cd52ff0f099890 100644 (file)
@@ -191,6 +191,11 @@ public:
   /// \param theModes a list of modes
   static void sketchSelectionModes(QIntList& theModes);
 
+  /// Connects or disconnects to the value changed signal of the property panel widgets
+  /// \param theWidget a property contol widget
+  /// \param isToConnect a boolean value whether connect or disconnect
+  void connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect);
+
 public slots:
   /// Process sketch plane selected event
   void onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>& thePln);
@@ -205,9 +210,6 @@ private slots:
   /// Process the leave mouse of the view port. If the current operation is a create of
   /// a nested sketch feature, it hides the feature in the viewer
   void onLeaveViewPort();
-
-  /// Validates the operation. Apply button is disabled if the widget value is in Modified state
-  void onValueStateChanged();
   /// Listens to the value changed signal and display the current operation feature
   void onBeforeValuesChangedInPropertyPanel();
   /// Listens to the signal about values are to be changed in the property panel
@@ -269,10 +271,6 @@ private:
                                   const FeatureToSelectionMap& theSelection,
                                   SelectMgr_IndexedMapOfOwner& anOwnersToSelect);
 
-  /// Connects or disconnects to the value changed signal of the property panel widgets
-  /// \param isToConnect a boolean value whether connect or disconnect
-  void connectToPropertyPanel(const bool isToConnect);
-
   /// Returns true if the created feature is visible
   /// \param 
   bool isVisibleCreatedFeature() const;
old mode 100644 (file)
new mode 100755 (executable)
index e484aa4..a363327
@@ -460,6 +460,7 @@ void XGUI_Workshop::onOperationStarted(ModuleBase_Operation* theOperation)
   }
   updateCommandStatus();
 
+  connectToPropertyPanel(true);
   myModule->operationStarted(aFOperation);
 
   // the objects of the current operation should be deactivated
@@ -508,6 +509,7 @@ void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation)
   hidePropertyPanel();
   myPropertyPanel->cleanContent();
 
+  connectToPropertyPanel(false);
   myModule->operationStopped(aFOperation);
 
   // the deactivated objects of the current operation should be activated back.
@@ -607,6 +609,23 @@ void XGUI_Workshop::setPropertyPanel(ModuleBase_Operation* theOperation)
   myErrorMgr->setPropertyPanel(myPropertyPanel);
 }
 
+void XGUI_Workshop::connectToPropertyPanel(const bool isToConnect)
+{
+  XGUI_PropertyPanel* aPropertyPanel = propertyPanel();
+  if (aPropertyPanel) {
+    const QList<ModuleBase_ModelWidget*>& aWidgets = aPropertyPanel->modelWidgets();
+    foreach (ModuleBase_ModelWidget* aWidget, aWidgets) {
+       myModule->connectToPropertyPanel(aWidget, isToConnect);
+      if (isToConnect) {
+        connect(aWidget, SIGNAL(valueStateChanged()), this, SLOT(onValueStateChanged()));
+      }
+      else {
+        disconnect(aWidget, SIGNAL(valueStateChanged()), this, SLOT(onValueStateChanged()));
+      }
+    }
+  }
+}
+
 /*
  * Saves document with given name.
  */
@@ -843,6 +862,20 @@ void XGUI_Workshop::onRebuild()
 }
 
 //******************************************************
+}
+
+//******************************************************
+void XGUI_Workshop::onValueStateChanged()
+{
+  ModuleBase_ModelWidget* anActiveWidget = 0;
+  ModuleBase_Operation* anOperation = myOperationMgr->currentOperation();
+  if (anOperation) {
+    ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
+    if (aPanel)
+      anActiveWidget = aPanel->activeWidget();
+  }
+  if (anActiveWidget && anActiveWidget->getValueState() != ModuleBase_ModelWidget::Stored)
+    operationMgr()->onValidateOperation();
 ModuleBase_IModule* XGUI_Workshop::loadModule(const QString& theModule)
 {
   QString libName = QString::fromStdString(library(theModule.toStdString()));
old mode 100644 (file)
new mode 100755 (executable)
index 5d03eef..25a7110
@@ -299,6 +299,9 @@ signals:
   /// Rebuild data tree
   void onRebuild();
 
+  /// Validates the operation. Apply button is disabled if the widget value is in Modified state
+  void onValueStateChanged();
+
   /// Show property panel
   void showPropertyPanel();
 
@@ -339,6 +342,10 @@ signals:
   /// \param theOperation an operation
   void setPropertyPanel(ModuleBase_Operation* theOperation);
 
+  /// Connects or disconnects to the value changed signal of the property panel widgets
+  /// \param isToConnect a boolean value whether connect or disconnect
+  void connectToPropertyPanel(const bool isToConnect);
+
 private:
   /// Display all results
   //void displayAllResults();