]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
SALOME mode: dimension constraint operaion is not restarted by enter in the widget...
authornds <nds@opencascade.com>
Wed, 18 Nov 2015 06:52:08 +0000 (09:52 +0300)
committernds <nds@opencascade.com>
Wed, 18 Nov 2015 06:52:54 +0000 (09:52 +0300)
This is a workaround

src/ModuleBase/ModuleBase_DoubleSpinBox.cpp
src/ModuleBase/ModuleBase_DoubleSpinBox.h
src/ModuleBase/ModuleBase_WidgetEditor.cpp

index 488e8f11c4d9fc03b9f6b74854237770ad216e15..06c1afcd6a045dfd40970fc7fe35cfc11cf2ff64 100644 (file)
@@ -203,18 +203,24 @@ QString ModuleBase_DoubleSpinBox::removeTrailingZeroes(const QString& src) const
 
 void ModuleBase_DoubleSpinBox::keyPressEvent(QKeyEvent *theEvent)
 {
+  bool isEmitKeyRelease = false;
   switch (theEvent->key()) {
     case Qt::Key_Enter:
     case Qt::Key_Return: {
       // do not react to the Enter key, the property panel processes it
       if (!myIsEmitKeyPressEvent)
         return;
+      else
+        isEmitKeyRelease = true;
     }
     break;
     default:
       break;
   }
   QDoubleSpinBox::keyPressEvent(theEvent);
+
+  if (isEmitKeyRelease)
+    emit keyReleased(theEvent);
 }
 
 /*!
index f827ba264f684446f39c51e183939022a5ac23cc..ef22f8ad12bdfffb66dffd176af8d722e429deca 100644 (file)
@@ -60,6 +60,11 @@ Q_OBJECT
   /// \return the previous value
   bool enableKeyPressEvent(const bool& theEnable);
 
+signals:
+  /// The signal about key release on the control, that corresponds to the attribute
+  /// \param theEvent key release event
+  void keyReleased(QKeyEvent* theEvent);
+
  protected slots:
    /// Called on text changed
   virtual void onTextChanged(const QString&);
index 334c50492d4eff3a9bbeb042f8eb1fc206517318..87bb57ff1e23e5fb23737b7d5f76eb9f8810493c 100644 (file)
@@ -51,6 +51,9 @@ void ModuleBase_WidgetEditor::editedValue(double& outValue, QString& outText)
 
   ModuleBase_ParamSpinBox* anEditor = new ModuleBase_ParamSpinBox(&aDlg);
   anEditor->enableKeyPressEvent(true);
+  if (!myIsEditing) {
+    connect(anEditor, SIGNAL(keyReleased(QKeyEvent*)), this, SIGNAL(keyReleased(QKeyEvent*)));
+  }
 
   anEditor->setMinimum(0);
   anEditor->setMaximum(DBL_MAX);
@@ -67,6 +70,11 @@ void ModuleBase_WidgetEditor::editedValue(double& outValue, QString& outText)
 
   aDlg.move(QCursor::pos());
   aDlg.exec();
+
+  if (!myIsEditing) {
+    disconnect(anEditor, SIGNAL(keyReleased(QKeyEvent*)), this, SIGNAL(keyReleased(QKeyEvent*)));
+  }
+
   outText = anEditor->text();
   bool isDouble;
   double aValue = outText.toDouble(&isDouble);