]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
There was discovered a logic, that the feature is created in the operation, after...
authornds <natalia.donis@opencascade.com>
Wed, 11 Jun 2014 15:00:01 +0000 (19:00 +0400)
committernds <natalia.donis@opencascade.com>
Wed, 11 Jun 2014 15:00:01 +0000 (19:00 +0400)
The problem with the Sketch creation line operation, which need to fill the property start point by the last point of another feature. The functionality the operation done in the startOperation() virtual method. After, the property panel throw down the values set.
The decision is to redesign the operation-widget_factory-property panel functionality in order to set the default values to the feature at the moment of a new feature creation.

src/ModuleBase/ModuleBase_IOperation.h
src/ModuleBase/ModuleBase_Operation.cpp
src/ModuleBase/ModuleBase_Operation.h
src/ModuleBase/ModuleBase_WidgetFactory.cpp
src/ModuleBase/ModuleBase_WidgetFactory.h

index 4af5c227f6abe858f23262cd958fab9cc3e2cd2a..a936a6f1073ef8e8780b42f27ca7906c8978cffc 100644 (file)
@@ -106,9 +106,6 @@ public slots:
   void setRunning(bool theState);
 
   // Data model methods.
-  /// Stores a real value in model.
-  /// \param theValue - to store
-  virtual void storeReal(double theValue) = 0;
   /// Stores a custom value in model.
   virtual void storeCustomValue() = 0;
 
index 52b23a92c7a7e337adeae683e38a4260e768b3db..3a5364fe89864a5e2ee1863f93bcce2ceef585df 100644 (file)
@@ -47,22 +47,6 @@ bool ModuleBase_Operation::isNestedOperationsEnabled() const
   return true;
 }
 
-void ModuleBase_Operation::storeReal(double theValue)
-{
-  if(!myFeature){
-    #ifdef _DEBUG
-    qDebug() << "ModuleBase_Operation::storeReal: " <<
-        "trying to store value without opening a transaction.";
-    #endif
-    return;
-  }
-  QString anId = sender()->objectName();
-  boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
-  boost::shared_ptr<ModelAPI_AttributeDouble> aReal = aData->real(anId.toStdString());
-  aReal->setValue(theValue);
-  Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
-}
-
 void ModuleBase_Operation::storeCustomValue()
 {
   if(!myFeature){
index a526655a2ab787d574a4706caedd7f5f06bdd188..6e5830bd750d981de6b53af10284800e5e0d4097 100644 (file)
@@ -63,9 +63,6 @@ public:
   virtual bool isNestedOperationsEnabled() const;
 
   // Data model methods.
-  /// Stores a real value in model.
-  /// \param theValue - to store
-  void storeReal(double theValue);
   /// Stores a custom value in model.
   void storeCustomValue();
 
index 239b3eda336bdcf0034bbdec8d71c8b53ead0570..03a715f2357fc255141ae4933bd3c552b363844a 100644 (file)
@@ -161,25 +161,12 @@ QWidget* ModuleBase_WidgetFactory::doubleSpinBoxControl(QWidget* theParent)
 QWidget* ModuleBase_WidgetFactory::pointSelectorControl(QWidget* theParent)
 {
   ModuleBase_WidgetPoint2D* aWidget = new ModuleBase_WidgetPoint2D(theParent, myWidgetApi);
-  connectWidget(aWidget, WDG_POINT_SELECTOR);
+  QObject::connect(aWidget, SIGNAL(valuesChanged()),  myOperation, SLOT(storeCustomValue()));
+
   myModelWidgets.append(aWidget);
   return aWidget->getControl();
 }
 
-bool ModuleBase_WidgetFactory::connectWidget(QObject* theWidget,  const QString& theType)
-{
-  bool result = false;
-  if (theType == WDG_DOUBLEVALUE) {
-    result = QObject::connect(theWidget, SIGNAL(valueChanged(double)), 
-                              myOperation, SLOT(storeReal(double)));
-  }
-  if (theType == WDG_POINT_SELECTOR) {
-    result = QObject::connect(theWidget, SIGNAL(valuesChanged()),
-                              myOperation, SLOT(storeCustomValue()));
-  }
-  return result;
-}
-
 QString ModuleBase_WidgetFactory::qs(const std::string& theStdString) const
 {
   return QString::fromStdString(theStdString);
index e20fd2d9cf7191ddfa151b9cdfb6d97fe0aefb89..13f16601ba8d4188e0a489239677f3c439266531 100644 (file)
@@ -43,7 +43,6 @@ protected:
   QWidget* selectorControl(QWidget* theParent);
   QWidget* booleanControl(QWidget* theParent);
 
-  bool connectWidget(QObject*, const QString&);
   QString qs(const std::string& theStdString) const;
 
 private: