Salome HOME
PAL8536. In SMESHGUI_doubleParameter::InitializeWidget() allow going down to _bottom
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_aParameter.cxx
index 7d40358d3758c34747c3dc05c55cc231a088dd29..7ba5e20dc774991f46940b9eccd2e857a4e2e84e 100644 (file)
@@ -29,6 +29,8 @@
   
 #include <qspinbox.h>
 #include <qvalidator.h>
+#include <qtextedit.h>
+
 #include "QAD_SpinBoxDbl.h"
 
 SMESHGUI_aParameter::~SMESHGUI_aParameter() {}
@@ -58,6 +60,10 @@ bool SMESHGUI_intParameter::GetNewDouble( double & Value ) const
 {
   return false;
 }
+bool SMESHGUI_intParameter::GetNewText( QString & Value ) const
+{
+  return false;
+}
 void SMESHGUI_intParameter::InitializeWidget( QWidget* theQWidget) const
 {
   QSpinBox * aSpin = dynamic_cast< QSpinBox *>( theQWidget );
@@ -101,12 +107,17 @@ bool SMESHGUI_doubleParameter::GetNewDouble( double & Value ) const
   Value = _newValue;
   return _newValue != _initValue;
 }
+bool SMESHGUI_doubleParameter::GetNewText( QString & Value ) const
+{
+  return false;
+}
 void SMESHGUI_doubleParameter::InitializeWidget( QWidget* theQWidget) const
 {
   QAD_SpinBoxDbl * aSpin = dynamic_cast< QAD_SpinBoxDbl *>( theQWidget );
   if ( aSpin ) {
+    aSpin->setPrecision( _decimals );
+    aSpin->setDblPrecision( _bottom );
     aSpin->setRange( _bottom, _top );
-    ((QDoubleValidator*)(aSpin->validator()))->setRange( _bottom, _top, _decimals );
     aSpin->setValue( _initValue );
     aSpin->setLineStep( _step );
   }
@@ -117,3 +128,44 @@ void SMESHGUI_doubleParameter::TakeValue( QWidget* theQWidget)
   if ( aSpin )
     _newValue = aSpin->value();
 }
+
+//=================================================================================
+// class    : SMESHGUI_strParameter
+// purpose  :
+//=================================================================================
+SMESHGUI_strParameter::SMESHGUI_strParameter(const QString& theInitValue,
+                                             const QString& theLabel)
+     :SMESHGUI_aParameter(theLabel),
+      _initValue( theInitValue )
+{
+}
+SMESHGUI_aParameter::Type SMESHGUI_strParameter::GetType() const
+{
+  return SMESHGUI_aParameter::TEXT;
+}
+bool SMESHGUI_strParameter::GetNewInt( int & theValue ) const
+{
+  return false;
+}
+bool SMESHGUI_strParameter::GetNewDouble( double & Value ) const
+{
+  return false;
+}
+bool SMESHGUI_strParameter::GetNewText( QString & theValue ) const
+{
+  theValue = _newValue;
+  return _newValue != _initValue;
+}
+void SMESHGUI_strParameter::InitializeWidget( QWidget* theQWidget) const
+{
+  QTextEdit * anEdit = dynamic_cast< QTextEdit *>( theQWidget );
+  if ( anEdit ) {
+    anEdit->setText( _initValue );
+  }
+}
+void SMESHGUI_strParameter::TakeValue( QWidget* theQWidget)
+{
+  QTextEdit * anEdit = dynamic_cast< QTextEdit *>( theQWidget );
+  if ( anEdit )
+    _newValue = anEdit->text();
+}