Salome HOME
re-entrant operation: fillet operation should be restarted by the first enter.
authornds <nds@opencascade.com>
Wed, 11 Nov 2015 12:29:03 +0000 (15:29 +0300)
committernds <nds@opencascade.com>
Wed, 11 Nov 2015 12:29:30 +0000 (15:29 +0300)
Correction: the operation state(ModifiedInPP) should be used instead of additional internal state in the controls.

src/ModuleBase/ModuleBase_DoubleSpinBox.cpp
src/ModuleBase/ModuleBase_DoubleSpinBox.h
src/ModuleBase/ModuleBase_IntSpinBox.cpp
src/ModuleBase/ModuleBase_IntSpinBox.h
src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp
src/ModuleBase/ModuleBase_WidgetExprEditor.cpp
src/ModuleBase/ModuleBase_WidgetIntValue.cpp
src/PartSet/PartSet_WidgetPoint2d.cpp
src/PartSet/PartSet_WidgetPoint2dDistance.cpp

index 081ca65b3fb12dad6800a131d18cda5e0c95a9c1..745592709c31534aa7b88a098eb42ceefe3b0cee 100644 (file)
@@ -59,7 +59,7 @@ const double PSEUDO_ZERO = 1.e-20;
 ModuleBase_DoubleSpinBox::ModuleBase_DoubleSpinBox(QWidget* theParent, int thePrecision)
     : QDoubleSpinBox(theParent),
       myCleared(false),
-      myIsModified(false),
+      //myIsModified(false),
       myIsEmitKeyPressEvent(false)
 {
   // VSR 01/07/2010: Disable thousands separator for spin box
@@ -327,10 +327,10 @@ QValidator::State ModuleBase_DoubleSpinBox::validate(QString& str, int& pos) con
 void ModuleBase_DoubleSpinBox::onTextChanged(const QString& )
 {
   myCleared = false;
-  myIsModified = true;
+  //myIsModified = true;
 }
 
-void ModuleBase_DoubleSpinBox::onValueChanged(const QString& theValue)
+/*void ModuleBase_DoubleSpinBox::onValueChanged(const QString& theValue)
 {
   myIsModified = true;
 }
@@ -343,7 +343,7 @@ bool ModuleBase_DoubleSpinBox::isModified() const
 void ModuleBase_DoubleSpinBox::clearModified()
 {
   myIsModified = false;
-}
+}*/
 
 bool ModuleBase_DoubleSpinBox::enableKeyPressEvent(const bool& theEnable)
 {
index 63e6a7bbe4610e50691e4c3b6c5bf3c85e6c592d..f827ba264f684446f39c51e183939022a5ac23cc 100644 (file)
@@ -50,10 +50,10 @@ Q_OBJECT
   virtual QValidator::State validate(QString&, int&) const;
 
   /// Returns true if the current value is modified by has not been applyed yet
-  virtual bool isModified() const;
+  //virtual bool isModified() const;
 
   /// Clears modified state
-  void clearModified();
+  //void clearModified();
 
   /// Change enable/disable internal state to emit key press event
   /// \param theEnable if true, the signal is emitted
@@ -64,7 +64,7 @@ Q_OBJECT
    /// Called on text changed
   virtual void onTextChanged(const QString&);
   /// Called on value changed
-  void onValueChanged(const QString& theValue);
+  //void onValueChanged(const QString& theValue);
 
  protected:
    /// Removes extra trailing zero symbols
@@ -82,7 +82,7 @@ Q_OBJECT
   /// Precision value
   int myPrecision;
   /// Boolean value whether the spin box content is modified
-  bool myIsModified;
+  //bool myIsModified;
 };
 
 #endif
index 933cc845563dec52a89788f2ae5d41aa3534ef79..197bfc22e52ebbf6f73c9d3a35a1c3b7e1de72bb 100755 (executable)
@@ -8,13 +8,13 @@
 #include <QKeyEvent>
 
 ModuleBase_IntSpinBox::ModuleBase_IntSpinBox(QWidget* theParent)
-: QSpinBox(theParent),
-  myIsModified(false)
+: QSpinBox(theParent)//,
+  //myIsModified(false)
 {
-  connect(this, SIGNAL(valueChanged(const QString&)), this, SLOT(onValueChanged(const QString&)));
+  //connect(this, SIGNAL(valueChanged(const QString&)), this, SLOT(onValueChanged(const QString&)));
 }
 
-void ModuleBase_IntSpinBox::onValueChanged(const QString& theValue)
+/*void ModuleBase_IntSpinBox::onValueChanged(const QString& theValue)
 {
   myIsModified = true;
 }
@@ -27,4 +27,20 @@ bool ModuleBase_IntSpinBox::isModified() const
 void ModuleBase_IntSpinBox::clearModified()
 {
   myIsModified = false;
+}*/
+
+void ModuleBase_IntSpinBox::keyPressEvent(QKeyEvent *theEvent)
+{
+  switch (theEvent->key()) {
+    case Qt::Key_Enter:
+    case Qt::Key_Return: {
+      // do not react to the Enter key, the property panel processes it
+        return;
+    }
+    break;
+    default:
+      break;
+  }
+  QSpinBox::keyPressEvent(theEvent);
 }
+
index 2e6d959a48ce12c0ed40457685251b7eb401adc2..565e437144a724c8cffba088298b555a9cdaaf75 100755 (executable)
@@ -27,18 +27,22 @@ public:
   virtual ~ModuleBase_IntSpinBox() {};
 
   /// Returns true if the current value is modified by has not been applyed yet
-  virtual bool isModified() const;
+  //virtual bool isModified() const;
 
   /// Clears modified state
-  void clearModified();
+  //void clearModified();
 
 protected slots:
   /// Called on value changed
-  void onValueChanged(const QString& theValue);
+  //void onValueChanged(const QString& theValue);
 
- private:
+protected:
+  /// Called on key press event
+  virtual void keyPressEvent(QKeyEvent* theEvent);
+
+private:
   /// Boolean value whether the spin box content is modified
-  bool myIsModified;
+  //bool myIsModified;
 };
 
 #endif
index a43f02cb6b2b6e43db5d314a612e487f082e453c..06cfe0c0496cde8457a649cc5548cca53905badd 100644 (file)
@@ -158,10 +158,11 @@ QList<QWidget*> ModuleBase_WidgetDoubleValue::getControls() const
 
 bool ModuleBase_WidgetDoubleValue::processEnter()
 {
-  bool isModified = mySpinBox->isModified();
+  bool isModified = getValueState() == ModifiedInPP;
+  //bool isModified = mySpinBox->isModified();
   if (isModified) {
     emit valuesChanged();
-    mySpinBox->clearModified();
+    //mySpinBox->clearModified();
     mySpinBox->selectAll();
   }
   return isModified;
index 4c37116b2a9fb15487402461c43ca7bdb0d283cf..431a387f8d69c83bae09a9b73db7db1ad61b6e77 100644 (file)
@@ -314,10 +314,11 @@ QList<QWidget*> ModuleBase_WidgetExprEditor::getControls() const
 
 bool ModuleBase_WidgetExprEditor::processEnter()
 {
-  bool isModified = myEditor->isModified();
+  //bool isModified = myEditor->isModified();
+  bool isModified = getValueState() == ModifiedInPP;
   if (isModified) {
     emit valuesChanged();
-    myEditor->clearModified();
+    //myEditor->clearModified();
     myEditor->selectAll();
   }
   return isModified;
index b92d5863f3a3d71ac9ac852bf6afcbe7a8b0bce9..4cae38f12f8341ae6946221d00cc96c94c92d5a8 100644 (file)
@@ -142,10 +142,11 @@ QList<QWidget*> ModuleBase_WidgetIntValue::getControls() const
 
 bool ModuleBase_WidgetIntValue::processEnter()
 {
-  bool isModified = mySpinBox->isModified();
+  bool isModified = getValueState() == ModifiedInPP;
+  //bool isModified = mySpinBox->isModified();
   if (isModified) {
     emit valuesChanged();
-    mySpinBox->clearModified();
+    //mySpinBox->clearModified();
     mySpinBox->selectAll();
   }
   return isModified;
index ebfe32e00530ccc34534908a0970a667f7910d6b..ccf1a3f14970daeba86c286352b3c1e733076b30 100644 (file)
@@ -504,13 +504,14 @@ bool PartSet_WidgetPoint2D::isFeatureContainsPoint(const FeaturePtr& theFeature,
 
 bool PartSet_WidgetPoint2D::processEnter()
 {
-  bool isModified = myXSpin->isModified() || myYSpin->isModified();
+  //bool isModified = myXSpin->isModified() || myYSpin->isModified();
+  bool isModified = getValueState() == ModifiedInPP;
   if (isModified) {
-    bool isXModified = myXSpin->isModified();
+    bool isXModified = myXSpin->hasFocus();//myXSpin->isModified();
     emit valuesChanged();
     //onValuesChanged();
-    myXSpin->clearModified();
-    myYSpin->clearModified();
+    //myXSpin->clearModified();
+    //myYSpin->clearModified();
     if (isXModified)
       myXSpin->selectAll();
     else
index ef7bf36c0d2430458290408ec283738b2f1f4ba3..829380cef043548846458c274782a0df8eecb46f 100644 (file)
@@ -120,10 +120,11 @@ void PartSet_WidgetPoint2dDistance::onMouseMove(ModuleBase_IViewWindow* theWnd,
 
 bool PartSet_WidgetPoint2dDistance::processEnter()
 {
-  bool isModified = mySpinBox->isModified();
+  //bool isModified = mySpinBox->isModified();
+  bool isModified = getValueState() == ModifiedInPP;
   if (isModified) {
     emit valuesChanged();
-    mySpinBox->clearModified();
+    //mySpinBox->clearModified();
     mySpinBox->selectAll();
   }
   return isModified;