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-05 11:43:42 +00:00
parent da4a6470be
commit 845309d919
30 changed files with 314 additions and 167 deletions

View File

@ -74,6 +74,14 @@
<parameter name="quadratic_mode" value="0"/> <parameter name="quadratic_mode" value="0"/>
<parameter name="max_angle" value="2"/> <parameter name="max_angle" value="2"/>
<parameter name="documentation" value="smesh_help"/> <parameter name="documentation" value="smesh_help"/>
<!-- Input field precisions -->
<parameter name="def_precision" value="3" />
<parameter name="length_precision" value="-6" />
<parameter name="angle_precision" value="-3" />
<parameter name="len_tol_precision" value="-7" />
<parameter name="parametric_precision" value="-6" />
<parameter name="area_precision" value="-6" />
<parameter name="vol_precision" value="-6" />
</section> </section>
<section name="smesh_help" > <section name="smesh_help" >
<parameter name="sub_menu" value="%1 module"/> <parameter name="sub_menu" value="%1 module"/>

View File

@ -3823,6 +3823,32 @@ void SMESHGUI::createPreferences()
setPreferenceProperty( nbSeg, "min", 1 ); setPreferenceProperty( nbSeg, "min", 1 );
setPreferenceProperty( nbSeg, "max", 10000000 ); setPreferenceProperty( nbSeg, "max", 10000000 );
// Quantities with individual precision settings
int precGroup = addPreference( tr( "SMESH_PREF_GROUP_PRECISION" ), genTab );
setPreferenceProperty( precGroup, "columns", 2 );
const int nbQuantities = 6;
int precs[nbQuantities], ii = 0;
precs[ii++] = addPreference( tr( "SMESH_PREF_length_precision" ), precGroup,
LightApp_Preferences::IntSpin, "SMESH", "length_precision" );
precs[ii++] = addPreference( tr( "SMESH_PREF_angle_precision" ), precGroup,
LightApp_Preferences::IntSpin, "SMESH", "angle_precision" );
precs[ii++] = addPreference( tr( "SMESH_PREF_len_tol_precision" ), precGroup,
LightApp_Preferences::IntSpin, "SMESH", "len_tol_precision" );
precs[ii++] = addPreference( tr( "SMESH_PREF_parametric_precision" ), precGroup,
LightApp_Preferences::IntSpin, "SMESH", "parametric_precision" );
precs[ii++] = addPreference( tr( "SMESH_PREF_area_precision" ), precGroup,
LightApp_Preferences::IntSpin, "SMESH", "area_precision" );
precs[ii ] = addPreference( tr( "SMESH_PREF_vol_precision" ), precGroup,
LightApp_Preferences::IntSpin, "SMESH", "vol_precision" );
// Set property for precision value for spinboxes
for ( ii = 0; ii < nbQuantities; ii++ ){
setPreferenceProperty( precs[ii], "min", -10 );
setPreferenceProperty( precs[ii], "max", 10 );
setPreferenceProperty( precs[ii], "precision", 2 );
}
// Mesh tab ------------------------------------------------------------------------ // Mesh tab ------------------------------------------------------------------------
int meshTab = addPreference( tr( "PREF_TAB_MESH" ) ); int meshTab = addPreference( tr( "PREF_TAB_MESH" ) );
int nodeGroup = addPreference( tr( "PREF_GROUP_NODES" ), meshTab ); int nodeGroup = addPreference( tr( "PREF_GROUP_NODES" ), meshTab );

View File

@ -137,7 +137,7 @@ SMESHGUI_BuildCompoundDlg::SMESHGUI_BuildCompoundDlg( SMESHGUI* theModule )
TextLabelTol = new QLabel(tr("SMESH_TOLERANCE"), GroupArgs); TextLabelTol = new QLabel(tr("SMESH_TOLERANCE"), GroupArgs);
TextLabelTol->setAlignment(Qt::AlignCenter); TextLabelTol->setAlignment(Qt::AlignCenter);
SpinBoxTol = new SMESHGUI_SpinBox(GroupArgs); SpinBoxTol = new SMESHGUI_SpinBox(GroupArgs);
SpinBoxTol->RangeStepAndValidator(0.0, COORD_MAX, 0.00001, 6); SpinBoxTol->RangeStepAndValidator(0.0, COORD_MAX, 0.00001, "len_tol_precision" );
GroupArgsLayout->addWidget(TextLabelMeshes, 0, 0); GroupArgsLayout->addWidget(TextLabelMeshes, 0, 0);
GroupArgsLayout->addWidget(SelectButton, 0, 1); GroupArgsLayout->addWidget(SelectButton, 0, 1);

View File

@ -343,7 +343,7 @@ SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( SMESHGUI* theModule ):
SMESHGUI_ClippingDlgLayout->setMargin(MARGIN); SMESHGUI_ClippingDlgLayout->setMargin(MARGIN);
// Controls for selecting, creating, deleting planes // Controls for selecting, creating, deleting planes
QGroupBox* GroupPlanes = new QGroupBox(tr("Clipping planes"), this); QGroupBox* GroupPlanes = new QGroupBox(tr("CLIP_PLANES"), this);
QHBoxLayout* GroupPlanesLayout = new QHBoxLayout(GroupPlanes); QHBoxLayout* GroupPlanesLayout = new QHBoxLayout(GroupPlanes);
GroupPlanesLayout->setSpacing(SPACING); GroupPlanesLayout->setSpacing(SPACING);
GroupPlanesLayout->setMargin(MARGIN); GroupPlanesLayout->setMargin(MARGIN);
@ -373,18 +373,18 @@ SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( SMESHGUI* theModule ):
SpinBoxDistance = new SMESHGUI_SpinBox(GroupParameters); SpinBoxDistance = new SMESHGUI_SpinBox(GroupParameters);
TextLabelRot1 = new QLabel(tr("Rotation around X (Y to Z):"), GroupParameters); TextLabelRot1 = new QLabel(tr("ROTATION_AROUND_X_Y2Z"), GroupParameters);
SpinBoxRot1 = new SMESHGUI_SpinBox(GroupParameters); SpinBoxRot1 = new SMESHGUI_SpinBox(GroupParameters);
TextLabelRot2 = new QLabel(tr("Rotation around Y (X to Z):"), GroupParameters); TextLabelRot2 = new QLabel(tr("ROTATION_AROUND_Y_X2Z"), GroupParameters);
SpinBoxRot2 = new SMESHGUI_SpinBox(GroupParameters); SpinBoxRot2 = new SMESHGUI_SpinBox(GroupParameters);
PreviewCheckBox = new QCheckBox(tr("Show preview"), GroupParameters); PreviewCheckBox = new QCheckBox(tr("SHOW_PREVIEW"), GroupParameters);
PreviewCheckBox->setChecked(true); PreviewCheckBox->setChecked(true);
AutoApplyCheckBox = new QCheckBox(tr("Auto Apply"), GroupParameters); AutoApplyCheckBox = new QCheckBox(tr("AUTO_APPLY"), GroupParameters);
AutoApplyCheckBox->setChecked(false); AutoApplyCheckBox->setChecked(false);
GroupParametersLayout->addWidget(TextLabelOrientation, 0, 0); GroupParametersLayout->addWidget(TextLabelOrientation, 0, 0);
@ -426,13 +426,13 @@ SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( SMESHGUI* theModule ):
SMESHGUI_ClippingDlgLayout->addWidget(GroupButtons); SMESHGUI_ClippingDlgLayout->addWidget(GroupButtons);
// Initial state // Initial state
SpinBoxDistance->RangeStepAndValidator(0.0, 1.0, 0.01, 3); SpinBoxDistance->RangeStepAndValidator(0.0, 1.0, 0.01, "length_precision" );
SpinBoxRot1->RangeStepAndValidator(-180.0, 180.0, 1, 3); SpinBoxRot1->RangeStepAndValidator(-180.0, 180.0, 1, "angle_precision" );
SpinBoxRot2->RangeStepAndValidator(-180.0, 180.0, 1, 3); SpinBoxRot2->RangeStepAndValidator(-180.0, 180.0, 1, "angle_precision" );
ComboBoxOrientation->addItem(tr("|| X-Y")); ComboBoxOrientation->addItem(tr("ALONG_XY"));
ComboBoxOrientation->addItem(tr("|| Y-Z")); ComboBoxOrientation->addItem(tr("ALONG_YZ"));
ComboBoxOrientation->addItem(tr("|| Z-X")); ComboBoxOrientation->addItem(tr("ALONG_ZX"));
SpinBoxDistance->SetValue(0.5); SpinBoxDistance->SetValue(0.5);
@ -699,16 +699,16 @@ void SMESHGUI_ClippingDlg::onSelectOrientation (int theItem)
return; return;
if (theItem == 0) { if (theItem == 0) {
TextLabelRot1->setText(tr("Rotation around X (Y to Z):")); TextLabelRot1->setText(tr("ROTATION_AROUND_X_Y2Z"));
TextLabelRot2->setText(tr("Rotation around Y (X to Z):")); TextLabelRot2->setText(tr("ROTATION_AROUND_Y_X2Z"));
} }
else if (theItem == 1) { else if (theItem == 1) {
TextLabelRot1->setText(tr("Rotation around Y (Z to X):")); TextLabelRot1->setText(tr("ROTATION_AROUND_Y_Z2X"));
TextLabelRot2->setText(tr("Rotation around Z (Y to X):")); TextLabelRot2->setText(tr("ROTATION_AROUND_Z_Y2X"));
} }
else if (theItem == 2) { else if (theItem == 2) {
TextLabelRot1->setText(tr("Rotation around Z (X to Y):")); TextLabelRot1->setText(tr("ROTATION_AROUND_Z_X2Y"));
TextLabelRot2->setText(tr("Rotation around X (Z to Y):")); TextLabelRot2->setText(tr("ROTATION_AROUND_X_Z2Y"));
} }
if((QComboBox*)sender() == ComboBoxOrientation) if((QComboBox*)sender() == ComboBoxOrientation)
@ -726,7 +726,7 @@ void SMESHGUI_ClippingDlg::Sinchronize()
QString aName; QString aName;
for(int i = 1; i<=aNbPlanes; i++) { for(int i = 1; i<=aNbPlanes; i++) {
aName = QString(tr("Plane# %1")).arg(i); aName = QString(tr("PLANE_NUM")).arg(i);
ComboBoxPlanes->addItem(aName); ComboBoxPlanes->addItem(aName);
} }
@ -737,7 +737,7 @@ void SMESHGUI_ClippingDlg::Sinchronize()
if (anIsControlsEnable) { if (anIsControlsEnable) {
onSelectPlane(aPos); onSelectPlane(aPos);
} else { } else {
ComboBoxPlanes->addItem(tr("No planes")); ComboBoxPlanes->addItem(tr("NO_PLANES"));
SpinBoxRot1->SetValue(0.0); SpinBoxRot1->SetValue(0.0);
SpinBoxRot2->SetValue(0.0); SpinBoxRot2->SetValue(0.0);
SpinBoxDistance->SetValue(0.5); SpinBoxDistance->SetValue(0.5);

View File

@ -520,7 +520,7 @@ SMESHGUI_EditMeshDlg::~SMESHGUI_EditMeshDlg()
void SMESHGUI_EditMeshDlg::Init() void SMESHGUI_EditMeshDlg::Init()
{ {
if (myAction == 0) { if (myAction == 0) {
SpinBoxTolerance->RangeStepAndValidator(0.0, COORD_MAX, 0.00001, 5); SpinBoxTolerance->RangeStepAndValidator(0.0, COORD_MAX, 0.00001, "len_tol_precision");
SpinBoxTolerance->SetValue(1e-05); SpinBoxTolerance->SetValue(1e-05);
} }

View File

@ -307,10 +307,10 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
/***************************************************************/ /***************************************************************/
// Initialisations // Initialisations
XSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); XSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
YSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); YSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
ZSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); ZSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
AngleSpin->RangeStepAndValidator(-180.0, 180.0, 5.0, 3); AngleSpin->RangeStepAndValidator(-180.0, 180.0, 5.0, "angle_precision");
mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();

View File

@ -249,16 +249,16 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
SMESHGUI_ExtrusionDlgLayout->addWidget(GroupButtons); SMESHGUI_ExtrusionDlgLayout->addWidget(GroupButtons);
/* Initialisations */ /* Initialisations */
SpinBox_Vx->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.01, 3); SpinBox_Vx->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.01, "length_precision");
SpinBox_Vy->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.01, 3); SpinBox_Vy->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.01, "length_precision");
SpinBox_Vz->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.01, 3); SpinBox_Vz->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.01, "length_precision");
SpinBox_Dx->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_Dx->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_Dy->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_Dy->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_Dz->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_Dz->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_NbSteps->setRange(1, 999999); SpinBox_NbSteps->setRange(1, 999999);
SpinBox_VDist->RangeStepAndValidator(0, COORD_MAX, 10.0, 3); SpinBox_VDist->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
RadioButton1->setChecked(true); RadioButton1->setChecked(true);
RadioButton3->setChecked(true); RadioButton3->setChecked(true);

View File

@ -124,9 +124,9 @@ QWidget* SMESHGUI_FindElemByPointDlg::createMainFrame (QWidget* theParent)
QLabel* aZLabel = new QLabel(tr("SMESH_Z"), aCoordGrp); QLabel* aZLabel = new QLabel(tr("SMESH_Z"), aCoordGrp);
myZ = new SMESHGUI_SpinBox(aCoordGrp); myZ = new SMESHGUI_SpinBox(aCoordGrp);
myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
myX->SetValue(0); myX->SetValue(0);
myY->SetValue(0); myY->SetValue(0);
myZ->SetValue(0); myZ->SetValue(0);

View File

@ -147,9 +147,9 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent)
QLabel* aZLabel = new QLabel(tr("SMESH_Z"), aCoordGrp); QLabel* aZLabel = new QLabel(tr("SMESH_Z"), aCoordGrp);
myZ = new SMESHGUI_SpinBox(aCoordGrp); myZ = new SMESHGUI_SpinBox(aCoordGrp);
myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
aCoordGrpLayout->addWidget(myCoordBtn); aCoordGrpLayout->addWidget(myCoordBtn);
aCoordGrpLayout->addWidget(aXLabel); aCoordGrpLayout->addWidget(aXLabel);

View File

@ -210,9 +210,9 @@ QWidget* SMESHGUI_MoveNodesDlg::createMainFrame (QWidget* theParent)
aCoordGrpLayout->addWidget(myZ); aCoordGrpLayout->addWidget(myZ);
//------------------------------------------------------------ //------------------------------------------------------------
myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, DBL_DIGITS_DISPLAY); myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, "length_precision");
myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, DBL_DIGITS_DISPLAY); myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, "length_precision");
myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, DBL_DIGITS_DISPLAY); myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, "length_precision");
//------------------------------------------------------------ //------------------------------------------------------------
QVBoxLayout* aLay = new QVBoxLayout(aFrame); QVBoxLayout* aLay = new QVBoxLayout(aFrame);

View File

@ -1163,7 +1163,7 @@ SMESHGUI_UnionOfTrianglesDlg
QLabel* aLab = new QLabel (tr("MAXIMUM_ANGLE"), aMaxAngleGrp); QLabel* aLab = new QLabel (tr("MAXIMUM_ANGLE"), aMaxAngleGrp);
myMaxAngleSpin = new SMESHGUI_SpinBox (aMaxAngleGrp); myMaxAngleSpin = new SMESHGUI_SpinBox (aMaxAngleGrp);
myMaxAngleSpin->RangeStepAndValidator(0, 180.0, 1.0, 3); myMaxAngleSpin->RangeStepAndValidator(0, 180.0, 1.0, "angle_precision");
myMaxAngleSpin->SetValue(30.0); myMaxAngleSpin->SetValue(30.0);
aMaxAngleGrpLayout->addWidget(aLab); aMaxAngleGrpLayout->addWidget(aLab);

View File

@ -350,9 +350,9 @@ void SMESHGUI_NodesDlg::Init()
double step = 25.0; double step = 25.0;
/* min, max, step and decimals for spin boxes */ /* min, max, step and decimals for spin boxes */
SpinBox_X->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY ); SpinBox_X->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, "length_precision" );
SpinBox_Y->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY ); SpinBox_Y->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, "length_precision" );
SpinBox_Z->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY ); SpinBox_Z->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, "length_precision" );
SpinBox_X->SetValue( 0.0 ); SpinBox_X->SetValue( 0.0 );
SpinBox_Y->SetValue( 0.0 ); SpinBox_Y->SetValue( 0.0 );
SpinBox_Z->SetValue( 0.0 ); SpinBox_Z->SetValue( 0.0 );

View File

@ -27,14 +27,14 @@
#include "SMESHGUI_Preferences_ColorDlg.h" #include "SMESHGUI_Preferences_ColorDlg.h"
#include "SMESHGUI.h" #include "SMESHGUI.h"
#include "SMESHGUI_SpinBox.h"
#include "SMESHGUI_Utils.h" #include "SMESHGUI_Utils.h"
// SALOME GUI includes // SALOME GUI includes
#include <SUIT_Desktop.h> #include <SUIT_Desktop.h>
#include <QtxColorButton.h> #include <QtxColorButton.h>
#include <QtxDoubleSpinBox.h>
#include <QtxIntSpinBox.h>
#include <VTKViewer_MarkerWidget.h> #include <VTKViewer_MarkerWidget.h>
#include <SalomeApp_IntSpinBox.h>
// Qt includes // Qt includes
#include <QGroupBox> #include <QGroupBox>
@ -43,7 +43,6 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QGridLayout> #include <QGridLayout>
#include <QSpinBox>
#include <QCheckBox> #include <QCheckBox>
#define SPACING 6 #define SPACING 6
@ -88,21 +87,24 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul
btn0DElementsColor = new QtxColorButton( ButtonGroup1 ); btn0DElementsColor = new QtxColorButton( ButtonGroup1 );
QLabel* TextLabel_0DElements_Size = new QLabel( tr( "Size of 0D elements" ), ButtonGroup1 ); QLabel* TextLabel_0DElements_Size = new QLabel( tr( "Size of 0D elements" ), ButtonGroup1 );
SpinBox_0DElements_Size = new QSpinBox( ButtonGroup1 ); SpinBox_0DElements_Size = new SalomeApp_IntSpinBox( ButtonGroup1 );
SpinBox_0DElements_Size->setAcceptNames( false ); // No Notebook variables allowed
SpinBox_0DElements_Size->setRange( 1, 10 ); SpinBox_0DElements_Size->setRange( 1, 10 );
SpinBox_0DElements_Size->setSingleStep( 1 ); SpinBox_0DElements_Size->setSingleStep( 1 );
SpinBox_0DElements_Size->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SpinBox_0DElements_Size->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
SpinBox_0DElements_Size->setButtonSymbols( QSpinBox::PlusMinus ); SpinBox_0DElements_Size->setButtonSymbols( QSpinBox::PlusMinus );
QLabel* TextLabel_Width = new QLabel( tr( "Width" ), ButtonGroup1 ); QLabel* TextLabel_Width = new QLabel( tr( "Width" ), ButtonGroup1 );
SpinBox_Width = new QSpinBox( ButtonGroup1 ); SpinBox_Width = new SalomeApp_IntSpinBox( ButtonGroup1 );
SpinBox_Width->setAcceptNames( false ); // No Notebook variables allowed
SpinBox_Width->setRange( 0, 5 ); SpinBox_Width->setRange( 0, 5 );
SpinBox_Width->setSingleStep( 1 ); SpinBox_Width->setSingleStep( 1 );
SpinBox_Width->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SpinBox_Width->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
SpinBox_Width->setButtonSymbols( QSpinBox::PlusMinus ); SpinBox_Width->setButtonSymbols( QSpinBox::PlusMinus );
QLabel* TextLabel_ShrinkCoeff = new QLabel( tr( "Shrink coef." ), ButtonGroup1 ); QLabel* TextLabel_ShrinkCoeff = new QLabel( tr( "Shrink coef." ), ButtonGroup1 );
SpinBox_Shrink = new QtxIntSpinBox( ButtonGroup1 ); SpinBox_Shrink = new SalomeApp_IntSpinBox( ButtonGroup1 );
SpinBox_Shrink->setAcceptNames( false ); // No Notebook variables allowed
SpinBox_Shrink->setRange( 20, 100 ); SpinBox_Shrink->setRange( 20, 100 );
SpinBox_Shrink->setSingleStep( 1 ); SpinBox_Shrink->setSingleStep( 1 );
SpinBox_Shrink->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SpinBox_Shrink->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
@ -156,9 +158,9 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul
btnOrientationColor = new QtxColorButton( ButtonGroup3 ); btnOrientationColor = new QtxColorButton( ButtonGroup3 );
QLabel* TextLabel_Orientation_Scale = new QLabel( tr( "Scale" ), ButtonGroup3 ); QLabel* TextLabel_Orientation_Scale = new QLabel( tr( "Scale" ), ButtonGroup3 );
SpinBox_Orientation_Scale = new QtxDoubleSpinBox( ButtonGroup3 ); SpinBox_Orientation_Scale = new SMESHGUI_SpinBox( ButtonGroup3 );
SpinBox_Orientation_Scale->setRange( 0.05, 0.5 ); SpinBox_Orientation_Scale->setAcceptNames( false ); // No Notebook variables allowed
SpinBox_Orientation_Scale->setSingleStep( 0.05 ); SpinBox_Orientation_Scale->RangeStepAndValidator( .05, .5, .05, "parametric_precision" );
SpinBox_Orientation_Scale->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SpinBox_Orientation_Scale->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
SpinBox_Orientation_Scale->setButtonSymbols( QSpinBox::PlusMinus ); SpinBox_Orientation_Scale->setButtonSymbols( QSpinBox::PlusMinus );

View File

@ -36,10 +36,9 @@
#include <QDialog> #include <QDialog>
class QCheckBox; class QCheckBox;
class QSpinBox;
class SMESHGUI; class SMESHGUI;
class QtxDoubleSpinBox; class SMESHGUI_SpinBox;
class QtxIntSpinBox; class SalomeApp_IntSpinBox;
class QtxColorButton; class QtxColorButton;
class VTKViewer_MarkerWidget; class VTKViewer_MarkerWidget;
@ -85,13 +84,13 @@ private:
QtxColorButton* btnBackFaceColor; QtxColorButton* btnBackFaceColor;
QtxColorButton* btnOutlineColor; QtxColorButton* btnOutlineColor;
QtxColorButton* btn0DElementsColor; QtxColorButton* btn0DElementsColor;
QSpinBox* SpinBox_0DElements_Size; SalomeApp_IntSpinBox* SpinBox_0DElements_Size;
QSpinBox* SpinBox_Width; SalomeApp_IntSpinBox* SpinBox_Width;
QtxIntSpinBox* SpinBox_Shrink; SalomeApp_IntSpinBox* SpinBox_Shrink;
QtxColorButton* btnNodeColor; QtxColorButton* btnNodeColor;
VTKViewer_MarkerWidget* MarkerWidget; VTKViewer_MarkerWidget* MarkerWidget;
QtxColorButton* btnOrientationColor; QtxColorButton* btnOrientationColor;
QtxDoubleSpinBox* SpinBox_Orientation_Scale; SMESHGUI_SpinBox* SpinBox_Orientation_Scale;
QCheckBox* CheckBox_Orientation_3DVectors; QCheckBox* CheckBox_Orientation_3DVectors;
}; };

View File

@ -27,6 +27,7 @@
#include "SMESHGUI_Preferences_ScalarBarDlg.h" #include "SMESHGUI_Preferences_ScalarBarDlg.h"
#include "SMESHGUI.h" #include "SMESHGUI.h"
#include "SMESHGUI_SpinBox.h"
#include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_Utils.h" #include "SMESHGUI_Utils.h"
@ -41,8 +42,8 @@
#include <LightApp_Application.h> #include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h> #include <LightApp_SelectionMgr.h>
#include <SALOME_ListIO.hxx> #include <SALOME_ListIO.hxx>
#include <SalomeApp_IntSpinBox.h>
#include <QtxDoubleSpinBox.h>
#include <QtxColorButton.h> #include <QtxColorButton.h>
// Qt includes // Qt includes
@ -54,7 +55,6 @@
#include <QLineEdit> #include <QLineEdit>
#include <QPushButton> #include <QPushButton>
#include <QRadioButton> #include <QRadioButton>
#include <QSpinBox>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QGridLayout> #include <QGridLayout>
@ -199,13 +199,15 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
QHBoxLayout* myLabColorGrpLayout = new QHBoxLayout( myLabColorGrp ); QHBoxLayout* myLabColorGrpLayout = new QHBoxLayout( myLabColorGrp );
myLabColorGrpLayout->setSpacing( SPACING_SIZE ); myLabColorGrpLayout->setMargin( MARGIN_SIZE ); myLabColorGrpLayout->setSpacing( SPACING_SIZE ); myLabColorGrpLayout->setMargin( MARGIN_SIZE );
myColorsSpin = new QSpinBox( myLabColorGrp ); myColorsSpin = new SalomeApp_IntSpinBox( myLabColorGrp );
myColorsSpin->setAcceptNames( false ); // No Notebook variables allowed
myColorsSpin->setRange( 2, 256 ); myColorsSpin->setRange( 2, 256 );
myColorsSpin->setSingleStep( 1 ); myColorsSpin->setSingleStep( 1 );
myColorsSpin->setMinimumWidth( MINIMUM_WIDTH ); myColorsSpin->setMinimumWidth( MINIMUM_WIDTH );
myColorsSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myColorsSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myLabelsSpin = new QSpinBox( myLabColorGrp ); myLabelsSpin = new SalomeApp_IntSpinBox( myLabColorGrp );
myLabelsSpin->setAcceptNames( false ); // No Notebook variables allowed
myLabelsSpin->setRange( 2, 65 ); myLabelsSpin->setRange( 2, 65 );
myLabelsSpin->setSingleStep( 1 ); myLabelsSpin->setSingleStep( 1 );
myLabelsSpin->setMinimumWidth( MINIMUM_WIDTH ); myLabelsSpin->setMinimumWidth( MINIMUM_WIDTH );
@ -242,19 +244,27 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
QGridLayout* myOriginDimGrpLayout = new QGridLayout( myOriginDimGrp ); QGridLayout* myOriginDimGrpLayout = new QGridLayout( myOriginDimGrp );
myOriginDimGrpLayout->setSpacing( SPACING_SIZE ); myOriginDimGrpLayout->setMargin( MARGIN_SIZE ); myOriginDimGrpLayout->setSpacing( SPACING_SIZE ); myOriginDimGrpLayout->setMargin( MARGIN_SIZE );
myXSpin = new QtxDoubleSpinBox (0.0, 1.0, 0.1, myOriginDimGrp); myXSpin = new SMESHGUI_SpinBox(myOriginDimGrp);
myXSpin->setAcceptNames( false );
myXSpin->RangeStepAndValidator( 0.0, 1.0, 0.1, "parametric_precision" );
myXSpin->setMinimumWidth( MINIMUM_WIDTH ); myXSpin->setMinimumWidth( MINIMUM_WIDTH );
myXSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myXSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myYSpin = new QtxDoubleSpinBox(0.0, 1.0, 0.1, myOriginDimGrp); myYSpin = new SMESHGUI_SpinBox(myOriginDimGrp);
myYSpin->setAcceptNames( false );
myYSpin->RangeStepAndValidator( 0.0, 1.0, 0.1, "parametric_precision" );
myYSpin->setMinimumWidth( MINIMUM_WIDTH ); myYSpin->setMinimumWidth( MINIMUM_WIDTH );
myYSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myYSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myWidthSpin = new QtxDoubleSpinBox(0.0, 1.0, 0.1, myOriginDimGrp); myWidthSpin = new SMESHGUI_SpinBox(myOriginDimGrp);
myWidthSpin->setAcceptNames( false );
myWidthSpin->RangeStepAndValidator( 0.0, 1.0, 0.1, "parametric_precision" );
myWidthSpin->setMinimumWidth( MINIMUM_WIDTH ); myWidthSpin->setMinimumWidth( MINIMUM_WIDTH );
myWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myHeightSpin = new QtxDoubleSpinBox(0.0, 1.0, 0.1, myOriginDimGrp); myHeightSpin = new SMESHGUI_SpinBox(myOriginDimGrp);
myHeightSpin->setAcceptNames( false );
myHeightSpin->RangeStepAndValidator( 0.0, 1.0, 0.1, "parametric_precision" );
myHeightSpin->setMinimumWidth( MINIMUM_WIDTH ); myHeightSpin->setMinimumWidth( MINIMUM_WIDTH );
myHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );

View File

@ -39,11 +39,11 @@ class QLineEdit;
class QPushButton; class QPushButton;
class QToolButton; class QToolButton;
class QRadioButton; class QRadioButton;
class QSpinBox;
class SMESHGUI; class SMESHGUI;
class SMESH_Actor; class SMESH_Actor;
class QtxDoubleSpinBox; class SMESHGUI_SpinBox;
class SalomeApp_IntSpinBox;
class QtxColorButton; class QtxColorButton;
class LightApp_SelectionMgr; class LightApp_SelectionMgr;
@ -103,18 +103,18 @@ private:
QCheckBox* myLabelsShadowCheck; QCheckBox* myLabelsShadowCheck;
QGroupBox* myLabColorGrp; QGroupBox* myLabColorGrp;
QSpinBox* myColorsSpin; SalomeApp_IntSpinBox* myColorsSpin;
QSpinBox* myLabelsSpin; SalomeApp_IntSpinBox* myLabelsSpin;
QGroupBox* myOrientationGrp; QGroupBox* myOrientationGrp;
QRadioButton* myVertRadioBtn; QRadioButton* myVertRadioBtn;
QRadioButton* myHorizRadioBtn; QRadioButton* myHorizRadioBtn;
QGroupBox* myOriginDimGrp; QGroupBox* myOriginDimGrp;
QtxDoubleSpinBox* myXSpin; SMESHGUI_SpinBox* myXSpin;
QtxDoubleSpinBox* myYSpin; SMESHGUI_SpinBox* myYSpin;
QtxDoubleSpinBox* myWidthSpin; SMESHGUI_SpinBox* myWidthSpin;
QtxDoubleSpinBox* myHeightSpin; SMESHGUI_SpinBox* myHeightSpin;
QGroupBox* myButtonGrp; QGroupBox* myButtonGrp;
QPushButton* myOkBtn; QPushButton* myOkBtn;

View File

@ -278,20 +278,20 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
SMESHGUI_RevolutionDlgLayout->addWidget(GroupButtons); SMESHGUI_RevolutionDlgLayout->addWidget(GroupButtons);
/* Initialisations */ /* Initialisations */
SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_Y->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_Y->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
RadioButton3->setChecked(true); RadioButton3->setChecked(true);
SpinBox_Angle->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5.0, 3); SpinBox_Angle->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5.0, "angle_precision");
SpinBox_NbSteps->setRange(1, 999999); SpinBox_NbSteps->setRange(1, 999999);
SpinBox_Tolerance->RangeStepAndValidator(0.0, COORD_MAX, 0.00001, 6); SpinBox_Tolerance->RangeStepAndValidator(0.0, COORD_MAX, 0.00001, "len_tol_precision");
RadioButton1->setChecked(true); RadioButton1->setChecked(true);

View File

@ -254,14 +254,14 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
SMESHGUI_RotationDlgLayout->addWidget(GroupButtons); SMESHGUI_RotationDlgLayout->addWidget(GroupButtons);
/* Initialisations */ /* Initialisations */
SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_Y->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_Y->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_Angle->RangeStepAndValidator(-360.0, +360.0, 5.0, 3); SpinBox_Angle->RangeStepAndValidator(-360.0, +360.0, 5.0, "angle_precision");
myConstructorId = 0; myConstructorId = 0;
RadioButton1->setChecked(true); RadioButton1->setChecked(true);

View File

@ -263,17 +263,14 @@ SMESHGUI_ScaleDlg::SMESHGUI_ScaleDlg( SMESHGUI* theModule )
SMESHGUI_ScaleDlgLayout->addWidget(GroupButtons); SMESHGUI_ScaleDlgLayout->addWidget(GroupButtons);
/* Initialisations */ /* Initialisations */
SpinBox1_1->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); SpinBox1_1->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox1_2->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); SpinBox1_2->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox1_3->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); SpinBox1_3->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
//SpinBox_FX->RangeStepAndValidator(0.0, COORD_MAX, 1.0, DBL_DIGITS_DISPLAY); SpinBox_FX->RangeStepAndValidator(1.e-6, 1.e+6, 1.0, "parametric_precision");
//SpinBox_FY->RangeStepAndValidator(0.0, COORD_MAX, 1.0, DBL_DIGITS_DISPLAY);
//SpinBox_FZ->RangeStepAndValidator(0.0, COORD_MAX, 1.0, DBL_DIGITS_DISPLAY);
SpinBox_FX->RangeStepAndValidator(1.e-6, 1.e+6, 1.0, DBL_DIGITS_DISPLAY);
SpinBox_FX->SetStep(0.1); SpinBox_FX->SetStep(0.1);
SpinBox_FY->RangeStepAndValidator(1.e-6, 1.e+6, 1.0, DBL_DIGITS_DISPLAY); SpinBox_FY->RangeStepAndValidator(1.e-6, 1.e+6, 1.0, "parametric_precision");
SpinBox_FY->SetStep(0.1); SpinBox_FY->SetStep(0.1);
SpinBox_FZ->RangeStepAndValidator(1.e-6, 1.e+6, 1.0, DBL_DIGITS_DISPLAY); SpinBox_FZ->RangeStepAndValidator(1.e-6, 1.e+6, 1.0, "parametric_precision");
SpinBox_FZ->SetStep(0.1); SpinBox_FZ->SetStep(0.1);
RadioButton1->setChecked(true); RadioButton1->setChecked(true);

View File

@ -229,7 +229,7 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule )
SpinBox_IterationLimit->setRange(1, 999999); SpinBox_IterationLimit->setRange(1, 999999);
SpinBox_IterationLimit->setValue(20); SpinBox_IterationLimit->setValue(20);
SpinBox_AspectRatio->RangeStepAndValidator(0.0, +999999.999, 0.1, 3); SpinBox_AspectRatio->RangeStepAndValidator(0.0, +999999.999, 0.1, "parametric_precision");
SpinBox_AspectRatio->SetValue(1.1); SpinBox_AspectRatio->SetValue(1.1);
GroupArguments->show(); GroupArguments->show();

View File

@ -26,9 +26,12 @@
// //
#include "SMESHGUI_SpinBox.h" #include "SMESHGUI_SpinBox.h"
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
// Qt includes // Qt includes
#include <QDoubleValidator>
#include <QLineEdit> #include <QLineEdit>
#include <QVariant>
//================================================================================= //=================================================================================
// class : SMESHGUI_SpinBox() // class : SMESHGUI_SpinBox()
@ -93,15 +96,6 @@ QLineEdit* SMESHGUI_SpinBox::editor() const
return SalomeApp_DoubleSpinBox::lineEdit(); return SalomeApp_DoubleSpinBox::lineEdit();
} }
//=================================================================================
// function : validator()
// purpose : returns validator
//=================================================================================
QDoubleValidator* SMESHGUI_SpinBox::validator() const
{
return (QDoubleValidator*)editor()->validator();
}
//================================================================================= //=================================================================================
// function : RangeStepAndValidator() // function : RangeStepAndValidator()
// purpose : // purpose :
@ -109,12 +103,22 @@ QDoubleValidator* SMESHGUI_SpinBox::validator() const
void SMESHGUI_SpinBox::RangeStepAndValidator( double min, void SMESHGUI_SpinBox::RangeStepAndValidator( double min,
double max, double max,
double step, double step,
unsigned short precision ) const char* quantity )
{ {
setPrecision(precision*(-1)); // PAL8769. Minus is for using 'g' double->string conversion specifier, // Obtain precision from preferences
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
int precision = resMgr->integerValue( "SMESH", quantity, -3 );
setPrecision(precision); // PAL8769. Minus is for using 'g' double->string conversion specifier,
// see QtxDoubleSpinBox::mapValueToText( double v ) // see QtxDoubleSpinBox::mapValueToText( double v )
setDecimals(32); // san: this can be achieved using preferences
setDecimals(qAbs(precision));
setRange(min, max); setRange(min, max);
setSingleStep( step ); setSingleStep( step );
setDefaultValue( min ); setDefaultValue( min );
// Add a hint for the user saying how to tune precision
QString userPropName = QObject::tr( QString( "SMESH_PREF_%1" ).arg( quantity ).toLatin1().constData() );
setProperty( "validity_tune_hint",
QVariant( QObject::tr( "SMESH_PRECISION_HINT" ).arg( userPropName ) ) );
} }

View File

@ -54,12 +54,11 @@ public:
void RangeStepAndValidator( double = -1000000.0, void RangeStepAndValidator( double = -1000000.0,
double = +1000000.0, double = +1000000.0,
double = 100.0, double = 100.0,
unsigned short = 3 ); const char* = "length_precision" );
void SetValue( double ); void SetValue( double );
double GetValue() const; double GetValue() const;
QString GetString() const; QString GetString() const;
QLineEdit* editor() const; QLineEdit* editor() const;
QDoubleValidator* validator() const;
public slots: public slots:
void SetStep( double ); void SetStep( double );

View File

@ -261,12 +261,12 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule )
SMESHGUI_SymmetryDlgLayout->addWidget(GroupButtons); SMESHGUI_SymmetryDlgLayout->addWidget(GroupButtons);
/* Initialisations */ /* Initialisations */
SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_Y->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_Y->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
RadioButton1->setChecked(true); RadioButton1->setChecked(true);

View File

@ -266,12 +266,12 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule )
SMESHGUI_TranslationDlgLayout->addWidget(GroupButtons); SMESHGUI_TranslationDlgLayout->addWidget(GroupButtons);
/* Initialisations */ /* Initialisations */
SpinBox1_1->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); SpinBox1_1->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox1_2->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); SpinBox1_2->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox1_3->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); SpinBox1_3->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox2_1->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); SpinBox2_1->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox2_2->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); SpinBox2_2->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
SpinBox2_3->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); SpinBox2_3->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
RadioButton1->setChecked(true); RadioButton1->setChecked(true);

View File

@ -3162,6 +3162,40 @@ Consider saving your work before application crash</translation>
<source>NO_MESH_SELECTED</source> <source>NO_MESH_SELECTED</source>
<translation>No mesh selected</translation> <translation>No mesh selected</translation>
</message> </message>
<message>
<source>SMESH_PREF_def_precision</source>
<translation>Default precision</translation>
</message>
<message>
<source>SMESH_PREF_length_precision</source>
<translation>Length precision</translation>
</message>
<message>
<source>SMESH_PREF_angle_precision</source>
<translation>Angular precision</translation>
</message>
<message>
<source>SMESH_PREF_len_tol_precision</source>
<translation>Length tolerance precision</translation>
</message>
<message>
<source>SMESH_PREF_parametric_precision</source>
<translation>Parametric precision</translation>
</message>
<message>
<source>SMESH_PREF_area_precision</source>
<translation>Area precision</translation>
</message>
<message>
<source>SMESH_PREF_vol_precision</source>
<translation>Volume precision</translation>
</message>
<message>
<source>SMESH_PRECISION_HINT</source>
<translation>
Input value precision can be adjusted using
'%1' parameter in Mesh module preferences.</translation>
</message>
</context> </context>
<context> <context>
<name>SMESHGUI</name> <name>SMESHGUI</name>
@ -3242,6 +3276,10 @@ Please, create VTK viewer and try again</translation>
<source>PREF_NOTIFY_MODE</source> <source>PREF_NOTIFY_MODE</source>
<translation>Show a computation result notification</translation> <translation>Show a computation result notification</translation>
</message> </message>
<message>
<source>SMESH_PREF_GROUP_PRECISION</source>
<translation>Input fields precision</translation>
</message>
<message> <message>
<source>PREF_GROUP_ELEMENTS</source> <source>PREF_GROUP_ELEMENTS</source>
<translation>Elements</translation> <translation>Elements</translation>
@ -5081,4 +5119,63 @@ It is impossible to read point coordinates from file</translation>
<translation>No concurent submeshes detected</translation> <translation>No concurent submeshes detected</translation>
</message> </message>
</context> </context>
<context>
<name>SMESHGUI_ClippingDlg</name>
<message>
<source>CLIP_PLANES</source>
<translation>Clipping planes</translation>
</message>
<message>
<source>ROTATION_AROUND_X_Y2Z</source>
<translation>Rotation around X (Y to Z):</translation>
</message>
<message>
<source>ROTATION_AROUND_Y_X2Z</source>
<translation>Rotation around Y (X to Z):</translation>
</message>
<message>
<source>ROTATION_AROUND_Z_Y2X</source>
<translation>Rotation around Z (Y to X):</translation>
</message>
<message>
<source>ROTATION_AROUND_X_Z2Y</source>
<translation>Rotation around X (Z to Y):</translation>
</message>
<message>
<source>ROTATION_AROUND_Y_Z2X</source>
<translation>Rotation around Y (Z to X):</translation>
</message>
<message>
<source>ROTATION_AROUND_Z_X2Y</source>
<translation>Rotation around Z (X to Y):</translation>
</message>
<message>
<source>SHOW_PREVIEW</source>
<translation>Show preview</translation>
</message>
<message>
<source>AUTO_APPLY</source>
<translation>Auto Apply</translation>
</message>
<message>
<source>ALONG_XY</source>
<translation>|| X-Y</translation>
</message>
<message>
<source>ALONG_YZ</source>
<translation>|| Y-Z</translation>
</message>
<message>
<source>ALONG_ZX</source>
<translation>|| Z-X</translation>
</message>
<message>
<source>PLANE_NUM</source>
<translation>Plane# %1</translation>
</message>
<message>
<source>NO_PLANES</source>
<translation>No planes</translation>
</message>
</context>
</TS> </TS>

View File

@ -25,10 +25,11 @@
// //
#include "StdMeshersGUI_DistrTable.h" #include "StdMeshersGUI_DistrTable.h"
#include <SMESHGUI_SpinBox.h>
// Qt incldues // Qt incldues
#include <QItemDelegate> #include <QItemDelegate>
#include <QTableWidget> #include <QTableWidget>
#include <QDoubleSpinBox>
#include <QPushButton> #include <QPushButton>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QHBoxLayout> #include <QHBoxLayout>
@ -109,7 +110,7 @@ private:
struct EditorData struct EditorData
{ {
int r, c; int r, c;
QDoubleSpinBox* sb; SMESHGUI_SpinBox* sb;
EditorData() { reset(); } EditorData() { reset(); }
void reset() { r = -1; c = -1; sb = 0; } void reset() { r = -1; c = -1; sb = 0; }
}; };
@ -138,7 +139,7 @@ public:
void addRow(); void addRow();
void deleteRow(); void deleteRow();
void setEditor( int, int, QDoubleSpinBox* ); void setEditor( int, int, SMESHGUI_SpinBox* );
protected: protected:
void closeEditor( QWidget*, QAbstractItemDelegate::EndEditHint ); void closeEditor( QWidget*, QAbstractItemDelegate::EndEditHint );
@ -176,17 +177,21 @@ createEditor( QWidget* parent,
const QStyleOptionViewItem& /*option*/, const QStyleOptionViewItem& /*option*/,
const QModelIndex& index ) const const QModelIndex& index ) const
{ {
QDoubleSpinBox* sb = new QDoubleSpinBox( parent ); SMESHGUI_SpinBox* sb = new SMESHGUI_SpinBox( parent );
sb->setFrame(false);
sb->setMinimum( index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ? sb->setAcceptNames(false); // No Notebook variables allowed
double aMin = index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ?
myTable->argMinimum( index.row() ) : myTable->argMinimum( index.row() ) :
myTable->funcMinimum( index.row() ) ); myTable->funcMinimum( index.row() );
sb->setMaximum( index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ? double aMax = index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ?
myTable->argMaximum( index.row() ) : myTable->argMaximum( index.row() ) :
myTable->funcMaximum( index.row() ) ); myTable->funcMaximum( index.row() );
sb->setSingleStep( index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ? double aStep = index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ?
myTable->argStep( index.row() ) : myTable->argStep( index.row() ) :
myTable->funcStep( index.row() ) ); myTable->funcStep( index.row() );
sb->RangeStepAndValidator( aMin, aMax, aStep, "parametric_precision" );
sb->setFrame(false);
myTable->setEditor( index.row(), index.column(), sb ); myTable->setEditor( index.row(), index.column(), sb );
return sb; return sb;
} }
@ -196,7 +201,7 @@ StdMeshersGUI_DistrTableFrame::SpinBoxDelegate::
setEditorData( QWidget* editor, const QModelIndex& index ) const setEditorData( QWidget* editor, const QModelIndex& index ) const
{ {
QString value = index.model()->data(index, Qt::DisplayRole).toString(); QString value = index.model()->data(index, Qt::DisplayRole).toString();
QDoubleSpinBox* sb = static_cast<QDoubleSpinBox*>(editor); SMESHGUI_SpinBox* sb = static_cast<SMESHGUI_SpinBox*>(editor);
bool bOk = false; bool bOk = false;
double v = value.toDouble( &bOk ); double v = value.toDouble( &bOk );
@ -210,7 +215,7 @@ StdMeshersGUI_DistrTableFrame::SpinBoxDelegate::
setModelData( QWidget* editor, QAbstractItemModel* model, setModelData( QWidget* editor, QAbstractItemModel* model,
const QModelIndex& index ) const const QModelIndex& index ) const
{ {
QDoubleSpinBox* sb = static_cast<QDoubleSpinBox*>(editor); SMESHGUI_SpinBox* sb = static_cast<SMESHGUI_SpinBox*>(editor);
model->setData( index, QString::number( sb->value() ), Qt::DisplayRole ); model->setData( index, QString::number( sb->value() ), Qt::DisplayRole );
} }
@ -247,7 +252,7 @@ Table( QWidget* parent, int rows )
void void
StdMeshersGUI_DistrTableFrame::Table:: StdMeshersGUI_DistrTableFrame::Table::
setEditor( int r, int c, QDoubleSpinBox* sb ) setEditor( int r, int c, SMESHGUI_SpinBox* sb )
{ {
myEditorData.r = r; myEditorData.r = r;
myEditorData.c = c; myEditorData.c = c;

View File

@ -25,8 +25,9 @@
// //
#include "StdMeshersGUI_FixedPointsParamWdg.h" #include "StdMeshersGUI_FixedPointsParamWdg.h"
#include <QtxIntSpinBox.h> #include <SMESHGUI_SpinBox.h>
#include <QtxDoubleSpinBox.h>
#include <SalomeApp_IntSpinBox.h>
// Qt includes // Qt includes
#include <QPushButton> #include <QPushButton>
@ -81,7 +82,8 @@ QWidget* StdMeshersGUI_FixedPointsParamWdg::LineDelegate::createEditor( QWidget*
{ {
QWidget* w = 0; QWidget* w = 0;
if ( (index.column() == 1 ) ) { if ( (index.column() == 1 ) ) {
QtxIntSpinBox* sb = new QtxIntSpinBox( parent ); SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( parent );
sb->setAcceptNames( false ); // No Notebook variables allowed
sb->setFrame( false ); sb->setFrame( false );
sb->setRange( 1, 999); sb->setRange( 1, 999);
w = sb; w = sb;
@ -94,8 +96,8 @@ void StdMeshersGUI_FixedPointsParamWdg::LineDelegate::setModelData( QWidget* edi
QAbstractItemModel* model, QAbstractItemModel* model,
const QModelIndex& index ) const const QModelIndex& index ) const
{ {
model->setData( index, qobject_cast<QtxIntSpinBox*>( editor )->value(), Qt::EditRole ); model->setData( index, qobject_cast<SalomeApp_IntSpinBox*>( editor )->value(), Qt::EditRole );
model->setData( index, qobject_cast<QtxIntSpinBox*>( editor )->value(), Qt::UserRole ); model->setData( index, qobject_cast<SalomeApp_IntSpinBox*>( editor )->value(), Qt::UserRole );
} }
//================================================================================ //================================================================================
@ -114,7 +116,7 @@ StdMeshersGUI_FixedPointsParamWdg
myListWidget = new QListWidget( this ); myListWidget = new QListWidget( this );
myTreeWidget = new QTreeWidget( this ); myTreeWidget = new QTreeWidget( this );
mySpinBox = new QtxDoubleSpinBox( this ); mySpinBox = new SMESHGUI_SpinBox( this );
myAddButton = new QPushButton( tr( "SMESH_BUT_ADD" ), this ); myAddButton = new QPushButton( tr( "SMESH_BUT_ADD" ), this );
myRemoveButton = new QPushButton( tr( "SMESH_BUT_REMOVE" ), this ); myRemoveButton = new QPushButton( tr( "SMESH_BUT_REMOVE" ), this );
mySameValues = new QCheckBox( tr("SMESH_SAME_NB_SEGMENTS"), this); mySameValues = new QCheckBox( tr("SMESH_SAME_NB_SEGMENTS"), this);
@ -141,10 +143,8 @@ StdMeshersGUI_FixedPointsParamWdg
myListWidget->setMinimumWidth( 80 ); myListWidget->setMinimumWidth( 80 );
myTreeWidget->setMinimumWidth( 200 ); myTreeWidget->setMinimumWidth( 200 );
mySpinBox->setRange( 0, 1 ); mySpinBox->setAcceptNames( false ); // No Notebook variables allowed
mySpinBox->setSingleStep( 0.1 ); mySpinBox->RangeStepAndValidator( 0., 1., .1, "parametric_precision" );
mySpinBox->setDecimals( 4 );
mySpinBox->setPrecision( 4 );
myListWidget->setMinimumWidth( 70 ); myListWidget->setMinimumWidth( 70 );
connect( myAddButton, SIGNAL( clicked() ), SLOT( onAdd() ) ); connect( myAddButton, SIGNAL( clicked() ), SLOT( onAdd() ) );

View File

@ -34,7 +34,7 @@
#include <QStringList> #include <QStringList>
class SMESHGUI; class SMESHGUI;
class QtxDoubleSpinBox; class SMESHGUI_SpinBox;
class QPushButton; class QPushButton;
class QLineEdit; class QLineEdit;
class QCheckBox; class QCheckBox;
@ -84,7 +84,7 @@ private:
private: private:
QListWidget* myListWidget; QListWidget* myListWidget;
QTreeWidget* myTreeWidget; QTreeWidget* myTreeWidget;
QtxDoubleSpinBox* mySpinBox; SMESHGUI_SpinBox* mySpinBox;
QPushButton* myAddButton; QPushButton* myAddButton;
QPushButton* myRemoveButton; QPushButton* myRemoveButton;
QCheckBox* mySameValues; QCheckBox* mySameValues;

View File

@ -149,7 +149,7 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame()
// 3) scale // 3) scale
myGroupLayout->addWidget( myLScale = new QLabel( tr( "SMESH_NB_SEGMENTS_SCALE_PARAM" ), GroupC1 ), row, 0 ); myGroupLayout->addWidget( myLScale = new QLabel( tr( "SMESH_NB_SEGMENTS_SCALE_PARAM" ), GroupC1 ), row, 0 );
myScale = new SMESHGUI_SpinBox( GroupC1 ); myScale = new SMESHGUI_SpinBox( GroupC1 );
myScale->RangeStepAndValidator( 1E-5, 1E+5, 0.1, 6 ); myScale->RangeStepAndValidator( 1E-5, 1E+5, 0.1, "parametric_precision" );
myGroupLayout->addWidget( myScale, row, 1 ); myGroupLayout->addWidget( myScale, row, 1 );
row++; row++;

View File

@ -1028,38 +1028,38 @@ void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int)
if( hypType()=="LocalLength" && sb ) if( hypType()=="LocalLength" && sb )
{ {
if (sb->objectName() == tr("SMESH_LOCAL_LENGTH_PARAM")) if (sb->objectName() == tr("SMESH_LOCAL_LENGTH_PARAM"))
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 ); sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
else if (sb->objectName() == tr("SMESH_LOCAL_LENGTH_PRECISION")) else if (sb->objectName() == tr("SMESH_LOCAL_LENGTH_PRECISION"))
sb->RangeStepAndValidator( 0.0, 1.0, 0.05, 7 ); sb->RangeStepAndValidator( 0.0, 1.0, 0.05, "len_tol_precision" );
} }
else if( hypType()=="Arithmetic1D" && sb ) else if( hypType()=="Arithmetic1D" && sb )
{ {
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 ); sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "parametric_precision" );
} }
else if( hypType()=="MaxLength" && sb ) else if( hypType()=="MaxLength" && sb )
{ {
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 ); sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
sb->setEnabled( !widget< QCheckBox >( 1 )->isChecked() ); sb->setEnabled( !widget< QCheckBox >( 1 )->isChecked() );
} }
else if( hypType()=="MaxElementArea" && sb ) else if( hypType()=="MaxElementArea" && sb )
{ {
sb->RangeStepAndValidator( VALUE_SMALL_2, VALUE_MAX_2, 1.0, 6 ); sb->RangeStepAndValidator( VALUE_SMALL_2, VALUE_MAX_2, 1.0, "area_precision" );
} }
else if( hypType()=="MaxElementVolume" && sb ) else if( hypType()=="MaxElementVolume" && sb )
{ {
sb->RangeStepAndValidator( VALUE_SMALL_3, VALUE_MAX_3, 1.0, 6 ); sb->RangeStepAndValidator( VALUE_SMALL_3, VALUE_MAX_3, 1.0, "vol_precision" );
} }
else if( hypType()=="StartEndLength" && sb ) else if( hypType()=="StartEndLength" && sb )
{ {
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 ); sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
} }
else if( hypType()=="Deflection1D" && sb ) else if( hypType()=="Deflection1D" && sb )
{ {
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 ); sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "parametric_precision" );
} }
else if ( sb ) // default validator for possible ancestors else if ( sb ) // default validator for possible ancestors
{ {
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 ); sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
} }
} }