]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1383 Preview button: store modified value before See preview
authornds <nds@opencascade.com>
Tue, 12 Apr 2016 12:41:11 +0000 (15:41 +0300)
committernds <nds@opencascade.com>
Tue, 12 Apr 2016 12:41:37 +0000 (15:41 +0300)
src/FeaturesPlugin/plugin-Features.xml
src/ModuleBase/ModuleBase_ModelWidget.h
src/SHAPERGUI/SHAPERGUI.cpp
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h

index ee7cdbbfb2d4981f47a5303b4ff066f8464badb2..1c084821d52d6488d418c862b7e2f05a133beef3 100644 (file)
@@ -3,7 +3,7 @@
 <plugin>
   <workbench id="Features" document="Part">
     <group id="Extrusion">
-      <feature id="Extrusion" title="Extrusion" tooltip="Create a solid by extrusion of a face" icon=":icons/extrusion.png" auto_preview="false">
+      <feature id="Extrusion" title="Extrusion" tooltip="Create a solid by extrusion of a face" icon=":icons/extrusion.png">
           <source path="extrusion_widget.xml"/>
       </feature>
       <!--<feature id="ExtrusionSketch" title="ExtrusionSketch" tooltip="Create a solids by extrusion of a sketch" icon=":icons/extrusionsketch.png">
       </feature>
     </group>
     <group id="Boolean">
-      <feature id="Boolean" title="Boolean" tooltip="Perform boolean operations with solids" icon=":icons/cut.png">
+      <feature id="Boolean" title="Boolean" tooltip="Perform boolean operations with solids" icon=":icons/cut.png"
+               auto_preview="false">
           <source path="boolean_widget.xml"/>
       </feature>
-      <feature id="Partition" title="Partition" tooltip="Perform partition operations with solids" icon=":icons/partition.png">
+      <feature id="Partition" title="Partition" tooltip="Perform partition operations with solids" icon=":icons/partition.png"
+               auto_preview="false">
           <source path="partition_widget.xml"/>
       </feature>
       <feature id="Intersection" title="Intersection" tooltip="Intersect objects with tools" icon=":icons/intersection.png">
index 11d983a33df0ce42cb33e323a70ee9799d63d02e..2075a16dee145981c8b13b56695c504b2f7b9ce7 100644 (file)
@@ -127,6 +127,10 @@ Q_OBJECT
   /// \return True in success
   bool restoreValue();
 
+  /// Saves the internal parameters to the given feature. Emits signals before and after store
+  /// \return True in success
+  bool storeValue();
+
   /// Set focus to the first control of the current widget. The focus policy of the control is checked.
   /// If the widget has the NonFocus focus policy, it is skipped.
   /// \return the state whether the widget can accept the focus
@@ -263,10 +267,6 @@ protected:
   /// or store the control value to the feature
   virtual void initializeValueByActivate();
 
-  /// Saves the internal parameters to the given feature. Emits signals before and after store
-  /// \return True in success
-  bool storeValue();
-
   /// Saves the internal parameters to the given feature
   /// \return True in success
   virtual bool storeValueCustom() const = 0;
@@ -321,8 +321,6 @@ private:
   bool myUseReset;
   /// blocked flag of modification of the value state
   bool myIsValueStateBlocked;
-
-  friend class ModuleBase_OperationFeature; // to call storeValue() by commit if value state is ModifiedInPP
 };
 
 #endif
index fecbbb031be34f7f22b092cc3709357fe7ef1249..a85c0d9a0e0991e00faca8634461c8e29b6973c4 100644 (file)
@@ -551,7 +551,10 @@ void SHAPERGUI::setFeatureInfo(const QString& theFeatureId,
 
 std::shared_ptr<Config_FeatureMessage> SHAPERGUI::featureInfo(const QString& theFeatureId)
 {
-  return myFeaturesInfo.contains(theFeatureId) ? myFeaturesInfo[theFeatureId] : NULL;
+  std::shared_ptr<Config_FeatureMessage> aMessage;
+  if (myFeaturesInfo.contains(theFeatureId))
+    aMessage =  myFeaturesInfo[theFeatureId];
+  return aMessage;
 }
 
 //******************************************************
index e7d8483fb5cdea7ed291aed4a822665b1deaba3f..77727cacbf8be40d4394644e6eb3adeb9da0d82e 100755 (executable)
@@ -68,6 +68,7 @@
 #include <ModuleBase_OperationAction.h>
 #include <ModuleBase_PagedContainer.h>
 #include <ModuleBase_WidgetValidated.h>
+#include <ModuleBase_ModelWidget.h>
 
 #include <Config_Common.h>
 #include <Config_FeatureMessage.h>
@@ -408,8 +409,15 @@ void XGUI_Workshop::onAcceptActionClicked()
 }
 
 //******************************************************
-void XGUI_Workshop::onPreivewActionClicked()
+void XGUI_Workshop::onPreviewActionClicked()
 {
+  ModuleBase_IPropertyPanel* aPanel = propertyPanel();
+  if (aPanel) {
+    ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
+    if (anActiveWidget && anActiveWidget->getValueState() == ModuleBase_ModelWidget::ModifiedInPP) {
+      anActiveWidget->storeValue();
+    }
+  }
   std::shared_ptr<Events_Message> aMsg = std::shared_ptr<Events_Message>(
                 new Events_Message(Events_Loop::eventByName(EVENT_PREVIEW_REQUESTED)));
   Events_Loop::loop()->send(aMsg);
@@ -1088,7 +1096,7 @@ void XGUI_Workshop::createDockWidgets()
   connect(aCancelAct, SIGNAL(triggered()), myOperationMgr, SLOT(onAbortOperation()));
 
   QAction* aPreviewAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::Preview);
-  connect(aPreviewAct, SIGNAL(triggered()), this, SLOT(onPreivewActionClicked()));
+  connect(aPreviewAct, SIGNAL(triggered()), this, SLOT(onPreviewActionClicked()));
 
   connect(myPropertyPanel, SIGNAL(keyReleased(QObject*, QKeyEvent*)),
           myOperationMgr,  SLOT(onKeyReleased(QObject*, QKeyEvent*)));
index e72ad9b6229299592b15326523ea042bf2a6e1a8..2c3946be59f2e62b93760f9a7c37a1082ae3f164 100755 (executable)
@@ -455,7 +455,7 @@ private:
 
   /// Called by Preview button clicked in the property panel. Sends signal to model to
   /// compute preview.
-  void onPreivewActionClicked();
+  void onPreviewActionClicked();
 
  private:
    /// Init menu