#include <qspinbox.h>
#include <qvalidator.h>
+#include <qtextedit.h>
+
#include "QAD_SpinBoxDbl.h"
+#include <utilities.h>
+
SMESHGUI_aParameter::~SMESHGUI_aParameter() {}
//=================================================================================
{
return false;
}
+bool SMESHGUI_intParameter::GetNewText( QString & Value ) const
+{
+ return false;
+}
void SMESHGUI_intParameter::InitializeWidget( QWidget* theQWidget) const
{
QSpinBox * aSpin = dynamic_cast< QSpinBox *>( theQWidget );
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 )
_newValue = aSpin->value();
}
+
+//=================================================================================
+// class : SMESHGUI_strParameter
+// purpose :
+//=================================================================================
+SMESHGUI_strParameter::SMESHGUI_strParameter(const QString& theInitValue,
+ const QString& theLabel)
+ :SMESHGUI_aParameter(theLabel),
+ _initValue( theInitValue )
+{
+ MESSAGE("SMESHGUI_strParameter::SMESHGUI_strParameter")
+}
+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
+{
+ MESSAGE("SMESHGUI_strParameter::InitializeWidget")
+ QTextEdit * anEdit = dynamic_cast< QTextEdit *>( theQWidget );
+ if ( anEdit ) {
+ anEdit->setText( _initValue );
+ }
+}
+void SMESHGUI_strParameter::TakeValue( QWidget* theQWidget)
+{
+ MESSAGE("SMESHGUI_strParameter::TakeValue")
+ QTextEdit * anEdit = dynamic_cast< QTextEdit *>( theQWidget );
+ if ( anEdit )
+ _newValue = anEdit->text();
+}
SMESHGUI_aParameter(const QString& label):_label(label) {}
virtual ~SMESHGUI_aParameter();
- enum Type { INT, DOUBLE };
+ enum Type { INT, DOUBLE, TEXT };
virtual Type GetType() const = 0;
virtual bool GetNewInt( int & Value ) const = 0;
virtual bool GetNewDouble( double & Value ) const = 0;
+ virtual bool GetNewText( QString & Value ) const = 0;
virtual void InitializeWidget( QWidget* ) const = 0;
virtual void TakeValue( QWidget* ) = 0;
virtual Type GetType() const;
virtual bool GetNewInt( int & Value ) const;
virtual bool GetNewDouble( double & Value ) const;
+ virtual bool GetNewText( QString & Value ) const;
virtual void InitializeWidget( QWidget* ) const;
virtual void TakeValue( QWidget* );
virtual Type GetType() const;
virtual bool GetNewInt( int & Value ) const;
virtual bool GetNewDouble( double & Value ) const;
+ virtual bool GetNewText( QString & Value ) const;
virtual void InitializeWidget( QWidget* ) const;
virtual void TakeValue( QWidget* );
int _decimals;
};
+
+//=================================================================================
+// class : SMESHGUI_strParameter
+// purpose :
+//=================================================================================
+class SMESHGUI_strParameter: public SMESHGUI_aParameter
+{
+public:
+ SMESHGUI_strParameter(const QString& initValue = "",
+ const QString& label = QString::null);
+ QString InitValue() { return _initValue; }
+ virtual Type GetType() const;
+ virtual bool GetNewInt( int & Value ) const;
+ virtual bool GetNewDouble( double & Value ) const;
+ virtual bool GetNewText( QString & Value ) const;
+ virtual void InitializeWidget( QWidget* ) const;
+ virtual void TakeValue( QWidget* );
+
+ private:
+ QString _initValue, _newValue;
+};
+
#endif // SMESHGUI_aParameter.h
#include <qlayout.h>
#include <qspinbox.h>
#include <qvalidator.h>
+#include <qtextedit.h>
using namespace std;
QLabel * label = new QLabel( GroupC1, "TextLabel" );
GroupC1Layout->addWidget( label, row, 0 );
label->setText( param->Label() );
- QWidget* aSpinWidget;
+ QWidget* aSpinWidget = 0;
switch ( param->GetType() ) {
case SMESHGUI_aParameter::DOUBLE: {
SMESHGUI_SpinBox* spin = new SMESHGUI_SpinBox( GroupC1 );
aSpinWidget = spin;
break;
}
+ case SMESHGUI_aParameter::TEXT: {
+ QTextEdit* edit = new QTextEdit( GroupC1 );
+ edit->setWordWrap( QTextEdit::NoWrap );
+ edit->setTextFormat( Qt::PlainText );
+ aSpinWidget = edit;
+ break;
+ }
default:;
}
- GroupC1Layout->addWidget( aSpinWidget, row, 1 );
- aSpinWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
- aSpinWidget->setMinimumSize( 150, 0 );
- param->InitializeWidget( aSpinWidget );
- mySpinList.push_back( aSpinWidget );
+ if ( aSpinWidget ) {
+ GroupC1Layout->addWidget( aSpinWidget, row, 1 );
+ aSpinWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+ aSpinWidget->setMinimumSize( 150, 0 );
+ param->InitializeWidget( aSpinWidget );
+ mySpinList.push_back( aSpinWidget );
+ }
}
/***************************************************************/
StdMeshersGUI_CreateHypothesisDlg.h \
StdMeshersGUI_CreateStdHypothesisDlg.h
-EXPORT_HEADERS = StdMeshersGUI_CreateHypothesisDlg.h
+EXPORT_HEADERS = StdMeshersGUI_CreateHypothesisDlg.h \
+ StdMeshersGUI_Parameters.h
LIB_CLIENT_IDL = \
SALOME_Exception.idl \
#include <qlayout.h>
#include <qpixmap.h>
#include <qspinbox.h>
+#include <qtextedit.h>
using namespace std;
QLabel * label = new QLabel( GroupC1, "TextLabel" );
GroupC1Layout->addWidget( label, row, 0 );
label->setText( param->Label() );
- QWidget* aSpinWidget;
+ QWidget* aSpinWidget = 0;
switch ( param->GetType() ) {
case SMESHGUI_aParameter::DOUBLE: {
SMESHGUI_SpinBox* spin = new SMESHGUI_SpinBox( GroupC1 );
aSpinWidget = spin;
break;
}
+ case SMESHGUI_aParameter::TEXT: {
+ QTextEdit* edit = new QTextEdit( GroupC1 );
+ edit->setWordWrap( QTextEdit::NoWrap );
+ edit->setTextFormat( Qt::PlainText );
+ aSpinWidget = edit;
+ break;
+ }
default:;
}
- GroupC1Layout->addWidget( aSpinWidget, row, 1 );
- aSpinWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
- aSpinWidget->setMinimumSize( 150, 0 );
- param->InitializeWidget( aSpinWidget );
- mySpinList.push_back( aSpinWidget );
+
+ if ( aSpinWidget ) {
+ GroupC1Layout->addWidget( aSpinWidget, row, 1 );
+ aSpinWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+ aSpinWidget->setMinimumSize( 150, 0 );
+ param->InitializeWidget( aSpinWidget );
+ mySpinList.push_back( aSpinWidget );
+ }
}
StdMeshersGUI_CreateHypothesisDlgLayout->addMultiCellWidget(GroupC1 , 1, 1, 0, 1 );
params = "";
list<SMESHGUI_aParameterPtr>::iterator paramIt = paramList.begin();
for ( ; paramIt != paramList.end(); paramIt++) {
- int aIntValue;
- double aDoubleValue;
if (params.compare("")) params += " ; ";
- if ((*paramIt)->GetType() == SMESHGUI_aParameter::INT) {
- (*paramIt)->GetNewInt(aIntValue);
- params += QString::number(aIntValue);;
+
+ if ((*paramIt)->GetType() == SMESHGUI_aParameter::DOUBLE ) {
+ double aDoubleValue = 0.;
+ (*paramIt)->GetNewDouble(aDoubleValue);
+ params += QString::number(aDoubleValue);
+ }
+ else if ((*paramIt)->GetType() == SMESHGUI_aParameter::TEXT ) {
+ QString aStrValue( "" );
+ (*paramIt)->GetNewText(aStrValue);
+ params += aStrValue.simplifyWhiteSpace();
}
else {
- (*paramIt)->GetNewDouble(aDoubleValue);
- params += QString::number(aDoubleValue);
+ int aIntValue = 0;
+ (*paramIt)->GetNewInt(aIntValue);
+ params += QString::number(aIntValue);;
}
}
}