Issue 0020580: improved validation in integer and double spin boxes, possibility to adjust input field precision through preferences

This commit is contained in:
san 2010-04-06 06:54:28 +00:00
parent 090ca6925e
commit a0117b464f
3 changed files with 17 additions and 25 deletions

View File

@ -30,6 +30,7 @@
#include <SMESHGUI_Utils.h>
#include <SMESHGUI_HypothesesUtils.h>
#include <SMESHGUI.h>
#include <SMESHGUI_SpinBox.h>
#include CORBA_SERVER_HEADER(NETGENPlugin_Algorithm)
@ -38,8 +39,6 @@
#include <SalomeApp_Tools.h>
#include <SalomeApp_DoubleSpinBox.h>
#include <QComboBox>
#include <QLabel>
#include <QGroupBox>
@ -110,11 +109,8 @@ QFrame* NETGENPluginGUI_HypothesisCreator::buildFrame()
}
aGroupLayout->addWidget( new QLabel( tr( "NETGEN_MAX_SIZE" ), GroupC1 ), row, 0 );
myMaxSize = new SalomeApp_DoubleSpinBox( GroupC1 );
myMaxSize->setDecimals( 7 );
myMaxSize->setMinimum( 1e-07 );
myMaxSize->setMaximum( 1e+06 );
myMaxSize->setSingleStep( 10 );
myMaxSize = new SMESHGUI_SpinBox( GroupC1 );
myMaxSize->RangeStepAndValidator( 1e-07, 1e+06, 10., "length_precision" );
aGroupLayout->addWidget( myMaxSize, row, 1 );
row++;
@ -132,26 +128,22 @@ QFrame* NETGENPluginGUI_HypothesisCreator::buildFrame()
row++;
aGroupLayout->addWidget( new QLabel( tr( "NETGEN_GROWTH_RATE" ), GroupC1 ), row, 0 );
myGrowthRate = new SalomeApp_DoubleSpinBox( GroupC1 );
myGrowthRate->setMinimum( 0.1 );
myGrowthRate->setMaximum( 10 );
myGrowthRate->setSingleStep( 0.1 );
myGrowthRate = new SMESHGUI_SpinBox( GroupC1 );
myGrowthRate->RangeStepAndValidator( .1, 10., .1, "parametric_precision" );
aGroupLayout->addWidget( myGrowthRate, row, 1 );
row++;
const double VALUE_MAX = 1.0e+6;
aGroupLayout->addWidget( new QLabel( tr( "NETGEN_SEG_PER_EDGE" ), GroupC1 ), row, 0 );
myNbSegPerEdge = new SalomeApp_DoubleSpinBox( GroupC1 );
myNbSegPerEdge->setMinimum( 0.2 );
myNbSegPerEdge->setMaximum( VALUE_MAX ); // (PAL14890) max value in native netgen gui is 5
myNbSegPerEdge = new SMESHGUI_SpinBox( GroupC1 );
myNbSegPerEdge->RangeStepAndValidator( .2, VALUE_MAX, .1, "parametric_precision" );
aGroupLayout->addWidget( myNbSegPerEdge, row, 1 );
row++;
aGroupLayout->addWidget( new QLabel( tr( "NETGEN_SEG_PER_RADIUS" ), GroupC1 ), row, 0 );
myNbSegPerRadius = new SalomeApp_DoubleSpinBox( GroupC1 );
myNbSegPerRadius->setMinimum( 0.2 );
myNbSegPerRadius->setMaximum( VALUE_MAX ); // (PAL14890) max value in native netgen gui is 5
myNbSegPerRadius = new SMESHGUI_SpinBox( GroupC1 );
myNbSegPerRadius->RangeStepAndValidator( .2, VALUE_MAX, .1, "parametric_precision" );
aGroupLayout->addWidget( myNbSegPerRadius, row, 1 );
row++;

View File

@ -32,7 +32,7 @@
#include <SMESHGUI_Hypotheses.h>
class SalomeApp_DoubleSpinBox;
class SMESHGUI_SpinBox;
class QComboBox;
class QCheckBox;
class QLineEdit;
@ -79,13 +79,13 @@ private:
private:
QLineEdit* myName;
SalomeApp_DoubleSpinBox* myMaxSize;
SMESHGUI_SpinBox* myMaxSize;
QCheckBox* mySecondOrder;
QCheckBox* myOptimize;
QComboBox* myFineness;
SalomeApp_DoubleSpinBox* myGrowthRate;
SalomeApp_DoubleSpinBox* myNbSegPerEdge;
SalomeApp_DoubleSpinBox* myNbSegPerRadius;
SMESHGUI_SpinBox* myGrowthRate;
SMESHGUI_SpinBox* myNbSegPerEdge;
SMESHGUI_SpinBox* myNbSegPerRadius;
QCheckBox* myAllowQuadrangles;
bool myIs2D;

View File

@ -151,7 +151,7 @@ QFrame* NETGENPluginGUI_SimpleCreator::buildFrame()
// * local length
myLengthRadioBut = new QRadioButton( tr( "SMESH_LOCAL_LENGTH_HYPOTHESIS" ), dimGroup );
myLength = new SMESHGUI_SpinBox( dimGroup );
myLength->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 0.1, 6 );
myLength->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 0.1, "length_precision" );
myLength->setValue( 1. );
dimLay->addWidget( myLengthRadioBut, dimRow, 0 );
dimLay->addWidget( myLength, dimRow, 1 );
@ -178,7 +178,7 @@ QFrame* NETGENPluginGUI_SimpleCreator::buildFrame()
// * max area
dimLay->addWidget( new QLabel( tr( "SMESH_MAX_ELEMENT_AREA_HYPOTHESIS" ), dimGroup), dimRow, 0);
myArea = new SMESHGUI_SpinBox( dimGroup );
myArea->RangeStepAndValidator( VALUE_SMALL_2, VALUE_MAX_2, 0.1, 6 );
myArea->RangeStepAndValidator( VALUE_SMALL_2, VALUE_MAX_2, 0.1, "area_precision" );
myArea->setValue( 1. );
dimLay->addWidget( myArea, dimRow, 1 );
dimRow++;
@ -205,7 +205,7 @@ QFrame* NETGENPluginGUI_SimpleCreator::buildFrame()
// * max volume
dimLay->addWidget(new QLabel( tr("SMESH_MAX_ELEMENT_VOLUME_HYPOTHESIS"), dimGroup), dimRow, 0);
myVolume = new SMESHGUI_SpinBox( dimGroup );
myVolume->RangeStepAndValidator( VALUE_SMALL_3, VALUE_MAX_3, 0.1, 6 );
myVolume->RangeStepAndValidator( VALUE_SMALL_3, VALUE_MAX_3, 0.1, "volume_precision" );
myVolume->setValue( 1. );
dimLay->addWidget( myVolume, dimRow, 1 );
dimRow++;