From: san Date: Mon, 5 Apr 2010 11:43:42 +0000 (+0000) Subject: Issue 0020580: improved validation in integer and double spin boxes, possibility... X-Git-Tag: V5_1_4a1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=845309d9194395babe18cf4fa92cc958879e0b5d;p=modules%2Fsmesh.git Issue 0020580: improved validation in integer and double spin boxes, possibility to adjust input field precision through preferences --- diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml index 690895886..7906feaab 100644 --- a/resources/SalomeApp.xml +++ b/resources/SalomeApp.xml @@ -74,6 +74,14 @@ + + + + + + + +
diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 52c6c2ab0..fcc5a1b03 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -3822,6 +3822,32 @@ void SMESHGUI::createPreferences() "SMESH", "nb_segments_per_edge" ); setPreferenceProperty( nbSeg, "min", 1 ); 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 ------------------------------------------------------------------------ int meshTab = addPreference( tr( "PREF_TAB_MESH" ) ); diff --git a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx index 1e58867d0..65f30ece8 100644 --- a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx @@ -137,7 +137,7 @@ SMESHGUI_BuildCompoundDlg::SMESHGUI_BuildCompoundDlg( SMESHGUI* theModule ) TextLabelTol = new QLabel(tr("SMESH_TOLERANCE"), GroupArgs); TextLabelTol->setAlignment(Qt::AlignCenter); 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(SelectButton, 0, 1); diff --git a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx index be11acf6c..208434c2e 100644 --- a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx @@ -343,7 +343,7 @@ SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( SMESHGUI* theModule ): SMESHGUI_ClippingDlgLayout->setMargin(MARGIN); // 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); GroupPlanesLayout->setSpacing(SPACING); GroupPlanesLayout->setMargin(MARGIN); @@ -373,18 +373,18 @@ SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( SMESHGUI* theModule ): 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); - 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); - PreviewCheckBox = new QCheckBox(tr("Show preview"), GroupParameters); + PreviewCheckBox = new QCheckBox(tr("SHOW_PREVIEW"), GroupParameters); PreviewCheckBox->setChecked(true); - AutoApplyCheckBox = new QCheckBox(tr("Auto Apply"), GroupParameters); + AutoApplyCheckBox = new QCheckBox(tr("AUTO_APPLY"), GroupParameters); AutoApplyCheckBox->setChecked(false); GroupParametersLayout->addWidget(TextLabelOrientation, 0, 0); @@ -426,13 +426,13 @@ SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( SMESHGUI* theModule ): SMESHGUI_ClippingDlgLayout->addWidget(GroupButtons); // Initial state - SpinBoxDistance->RangeStepAndValidator(0.0, 1.0, 0.01, 3); - SpinBoxRot1->RangeStepAndValidator(-180.0, 180.0, 1, 3); - SpinBoxRot2->RangeStepAndValidator(-180.0, 180.0, 1, 3); + SpinBoxDistance->RangeStepAndValidator(0.0, 1.0, 0.01, "length_precision" ); + SpinBoxRot1->RangeStepAndValidator(-180.0, 180.0, 1, "angle_precision" ); + SpinBoxRot2->RangeStepAndValidator(-180.0, 180.0, 1, "angle_precision" ); - ComboBoxOrientation->addItem(tr("|| X-Y")); - ComboBoxOrientation->addItem(tr("|| Y-Z")); - ComboBoxOrientation->addItem(tr("|| Z-X")); + ComboBoxOrientation->addItem(tr("ALONG_XY")); + ComboBoxOrientation->addItem(tr("ALONG_YZ")); + ComboBoxOrientation->addItem(tr("ALONG_ZX")); SpinBoxDistance->SetValue(0.5); @@ -699,16 +699,16 @@ void SMESHGUI_ClippingDlg::onSelectOrientation (int theItem) return; if (theItem == 0) { - TextLabelRot1->setText(tr("Rotation around X (Y to Z):")); - TextLabelRot2->setText(tr("Rotation around Y (X to Z):")); + TextLabelRot1->setText(tr("ROTATION_AROUND_X_Y2Z")); + TextLabelRot2->setText(tr("ROTATION_AROUND_Y_X2Z")); } else if (theItem == 1) { - TextLabelRot1->setText(tr("Rotation around Y (Z to X):")); - TextLabelRot2->setText(tr("Rotation around Z (Y to X):")); + TextLabelRot1->setText(tr("ROTATION_AROUND_Y_Z2X")); + TextLabelRot2->setText(tr("ROTATION_AROUND_Z_Y2X")); } else if (theItem == 2) { - TextLabelRot1->setText(tr("Rotation around Z (X to Y):")); - TextLabelRot2->setText(tr("Rotation around X (Z to Y):")); + TextLabelRot1->setText(tr("ROTATION_AROUND_Z_X2Y")); + TextLabelRot2->setText(tr("ROTATION_AROUND_X_Z2Y")); } if((QComboBox*)sender() == ComboBoxOrientation) @@ -726,7 +726,7 @@ void SMESHGUI_ClippingDlg::Sinchronize() QString aName; for(int i = 1; i<=aNbPlanes; i++) { - aName = QString(tr("Plane# %1")).arg(i); + aName = QString(tr("PLANE_NUM")).arg(i); ComboBoxPlanes->addItem(aName); } @@ -737,7 +737,7 @@ void SMESHGUI_ClippingDlg::Sinchronize() if (anIsControlsEnable) { onSelectPlane(aPos); } else { - ComboBoxPlanes->addItem(tr("No planes")); + ComboBoxPlanes->addItem(tr("NO_PLANES")); SpinBoxRot1->SetValue(0.0); SpinBoxRot2->SetValue(0.0); SpinBoxDistance->SetValue(0.5); diff --git a/src/SMESHGUI/SMESHGUI_EditMeshDlg.cxx b/src/SMESHGUI/SMESHGUI_EditMeshDlg.cxx index ac4ce0550..643893d9e 100644 --- a/src/SMESHGUI/SMESHGUI_EditMeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_EditMeshDlg.cxx @@ -520,7 +520,7 @@ SMESHGUI_EditMeshDlg::~SMESHGUI_EditMeshDlg() void SMESHGUI_EditMeshDlg::Init() { 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); } diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx index 2131b25e6..4b4a633e9 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx @@ -307,10 +307,10 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod /***************************************************************/ // Initialisations - XSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - YSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - ZSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - AngleSpin->RangeStepAndValidator(-180.0, 180.0, 5.0, 3); + XSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + YSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + ZSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + AngleSpin->RangeStepAndValidator(-180.0, 180.0, 5.0, "angle_precision"); mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx index 7c32fc1e2..97c91c135 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx @@ -249,16 +249,16 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule) SMESHGUI_ExtrusionDlgLayout->addWidget(GroupButtons); /* Initialisations */ - SpinBox_Vx->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.01, 3); - SpinBox_Vy->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.01, 3); - SpinBox_Vz->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, "length_precision"); + SpinBox_Vz->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.01, "length_precision"); - SpinBox_Dx->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - SpinBox_Dy->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - SpinBox_Dz->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, "length_precision"); + SpinBox_Dz->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); 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); RadioButton3->setChecked(true); diff --git a/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.cxx b/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.cxx index 03cca227b..78a64bee5 100644 --- a/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.cxx @@ -124,9 +124,9 @@ QWidget* SMESHGUI_FindElemByPointDlg::createMainFrame (QWidget* theParent) QLabel* aZLabel = new QLabel(tr("SMESH_Z"), aCoordGrp); myZ = new SMESHGUI_SpinBox(aCoordGrp); - myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); - myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); - myZ->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, "length_precision"); + myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); myX->SetValue(0); myY->SetValue(0); myZ->SetValue(0); diff --git a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx index ae769c301..b2b362d95 100644 --- a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx @@ -147,9 +147,9 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent) QLabel* aZLabel = new QLabel(tr("SMESH_Z"), aCoordGrp); myZ = new SMESHGUI_SpinBox(aCoordGrp); - myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); - myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); - myZ->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, "length_precision"); + myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); aCoordGrpLayout->addWidget(myCoordBtn); aCoordGrpLayout->addWidget(aXLabel); diff --git a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx index 6243255af..e4600ca32 100644 --- a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx @@ -210,9 +210,9 @@ QWidget* SMESHGUI_MoveNodesDlg::createMainFrame (QWidget* theParent) aCoordGrpLayout->addWidget(myZ); //------------------------------------------------------------ - myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, DBL_DIGITS_DISPLAY); - myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, DBL_DIGITS_DISPLAY); - myZ->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, "length_precision"); + myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, "length_precision"); //------------------------------------------------------------ QVBoxLayout* aLay = new QVBoxLayout(aFrame); diff --git a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx index edef76173..27aaa8c07 100755 --- a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx @@ -1163,7 +1163,7 @@ SMESHGUI_UnionOfTrianglesDlg QLabel* aLab = new QLabel (tr("MAXIMUM_ANGLE"), 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); aMaxAngleGrpLayout->addWidget(aLab); diff --git a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx index ebc42b198..9b5c42610 100644 --- a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx @@ -350,9 +350,9 @@ void SMESHGUI_NodesDlg::Init() double step = 25.0; /* min, max, step and decimals for spin boxes */ - SpinBox_X->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY ); - SpinBox_Y->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY ); - SpinBox_Z->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, "length_precision" ); + SpinBox_Z->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, "length_precision" ); SpinBox_X->SetValue( 0.0 ); SpinBox_Y->SetValue( 0.0 ); SpinBox_Z->SetValue( 0.0 ); diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx index 3b86bb27e..9a01ad34e 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx @@ -27,14 +27,14 @@ #include "SMESHGUI_Preferences_ColorDlg.h" #include "SMESHGUI.h" +#include "SMESHGUI_SpinBox.h" #include "SMESHGUI_Utils.h" // SALOME GUI includes #include #include -#include -#include #include +#include // Qt includes #include @@ -43,7 +43,6 @@ #include #include #include -#include #include #define SPACING 6 @@ -88,21 +87,24 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul btn0DElementsColor = new QtxColorButton( 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->setSingleStep( 1 ); SpinBox_0DElements_Size->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SpinBox_0DElements_Size->setButtonSymbols( QSpinBox::PlusMinus ); 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->setSingleStep( 1 ); SpinBox_Width->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SpinBox_Width->setButtonSymbols( QSpinBox::PlusMinus ); 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->setSingleStep( 1 ); SpinBox_Shrink->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); @@ -156,9 +158,9 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul btnOrientationColor = new QtxColorButton( ButtonGroup3 ); QLabel* TextLabel_Orientation_Scale = new QLabel( tr( "Scale" ), ButtonGroup3 ); - SpinBox_Orientation_Scale = new QtxDoubleSpinBox( ButtonGroup3 ); - SpinBox_Orientation_Scale->setRange( 0.05, 0.5 ); - SpinBox_Orientation_Scale->setSingleStep( 0.05 ); + SpinBox_Orientation_Scale = new SMESHGUI_SpinBox( ButtonGroup3 ); + SpinBox_Orientation_Scale->setAcceptNames( false ); // No Notebook variables allowed + SpinBox_Orientation_Scale->RangeStepAndValidator( .05, .5, .05, "parametric_precision" ); SpinBox_Orientation_Scale->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SpinBox_Orientation_Scale->setButtonSymbols( QSpinBox::PlusMinus ); diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h index cf899f3ad..404edcf34 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h +++ b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h @@ -36,10 +36,9 @@ #include class QCheckBox; -class QSpinBox; class SMESHGUI; -class QtxDoubleSpinBox; -class QtxIntSpinBox; +class SMESHGUI_SpinBox; +class SalomeApp_IntSpinBox; class QtxColorButton; class VTKViewer_MarkerWidget; @@ -85,13 +84,13 @@ private: QtxColorButton* btnBackFaceColor; QtxColorButton* btnOutlineColor; QtxColorButton* btn0DElementsColor; - QSpinBox* SpinBox_0DElements_Size; - QSpinBox* SpinBox_Width; - QtxIntSpinBox* SpinBox_Shrink; + SalomeApp_IntSpinBox* SpinBox_0DElements_Size; + SalomeApp_IntSpinBox* SpinBox_Width; + SalomeApp_IntSpinBox* SpinBox_Shrink; QtxColorButton* btnNodeColor; VTKViewer_MarkerWidget* MarkerWidget; QtxColorButton* btnOrientationColor; - QtxDoubleSpinBox* SpinBox_Orientation_Scale; + SMESHGUI_SpinBox* SpinBox_Orientation_Scale; QCheckBox* CheckBox_Orientation_3DVectors; }; diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx index 175677f53..218efdfff 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx @@ -27,6 +27,7 @@ #include "SMESHGUI_Preferences_ScalarBarDlg.h" #include "SMESHGUI.h" +#include "SMESHGUI_SpinBox.h" #include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_Utils.h" @@ -41,8 +42,8 @@ #include #include #include +#include -#include #include // Qt includes @@ -54,7 +55,6 @@ #include #include #include -#include #include #include #include @@ -199,13 +199,15 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI* QHBoxLayout* myLabColorGrpLayout = new QHBoxLayout( myLabColorGrp ); 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->setSingleStep( 1 ); myColorsSpin->setMinimumWidth( MINIMUM_WIDTH ); 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->setSingleStep( 1 ); myLabelsSpin->setMinimumWidth( MINIMUM_WIDTH ); @@ -242,19 +244,27 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI* QGridLayout* myOriginDimGrpLayout = new QGridLayout( myOriginDimGrp ); 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->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->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->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->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h index cc4126202..f980ac324 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h +++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h @@ -39,11 +39,11 @@ class QLineEdit; class QPushButton; class QToolButton; class QRadioButton; -class QSpinBox; class SMESHGUI; class SMESH_Actor; -class QtxDoubleSpinBox; +class SMESHGUI_SpinBox; +class SalomeApp_IntSpinBox; class QtxColorButton; class LightApp_SelectionMgr; @@ -103,18 +103,18 @@ private: QCheckBox* myLabelsShadowCheck; QGroupBox* myLabColorGrp; - QSpinBox* myColorsSpin; - QSpinBox* myLabelsSpin; + SalomeApp_IntSpinBox* myColorsSpin; + SalomeApp_IntSpinBox* myLabelsSpin; QGroupBox* myOrientationGrp; QRadioButton* myVertRadioBtn; QRadioButton* myHorizRadioBtn; QGroupBox* myOriginDimGrp; - QtxDoubleSpinBox* myXSpin; - QtxDoubleSpinBox* myYSpin; - QtxDoubleSpinBox* myWidthSpin; - QtxDoubleSpinBox* myHeightSpin; + SMESHGUI_SpinBox* myXSpin; + SMESHGUI_SpinBox* myYSpin; + SMESHGUI_SpinBox* myWidthSpin; + SMESHGUI_SpinBox* myHeightSpin; QGroupBox* myButtonGrp; QPushButton* myOkBtn; diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx index 484989dfd..cae6339b0 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx @@ -278,20 +278,20 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule ) SMESHGUI_RevolutionDlgLayout->addWidget(GroupButtons); /* Initialisations */ - SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - SpinBox_Y->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - SpinBox_DZ->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, "length_precision"); + SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); 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_Tolerance->RangeStepAndValidator(0.0, COORD_MAX, 0.00001, 6); + SpinBox_Tolerance->RangeStepAndValidator(0.0, COORD_MAX, 0.00001, "len_tol_precision"); RadioButton1->setChecked(true); diff --git a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx index d9352dbc8..a34ec8c65 100644 --- a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx @@ -254,14 +254,14 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule ) SMESHGUI_RotationDlgLayout->addWidget(GroupButtons); /* Initialisations */ - SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - SpinBox_Y->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - - SpinBox_Angle->RangeStepAndValidator(-360.0, +360.0, 5.0, 3); + SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + SpinBox_Y->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + + SpinBox_Angle->RangeStepAndValidator(-360.0, +360.0, 5.0, "angle_precision"); myConstructorId = 0; RadioButton1->setChecked(true); diff --git a/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx b/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx index 9968b10eb..c4706505e 100644 --- a/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx @@ -263,17 +263,14 @@ SMESHGUI_ScaleDlg::SMESHGUI_ScaleDlg( SMESHGUI* theModule ) SMESHGUI_ScaleDlgLayout->addWidget(GroupButtons); /* Initialisations */ - SpinBox1_1->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); - SpinBox1_2->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); - SpinBox1_3->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); - //SpinBox_FX->RangeStepAndValidator(0.0, COORD_MAX, 1.0, DBL_DIGITS_DISPLAY); - //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); + SpinBox1_1->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + SpinBox1_2->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + SpinBox1_3->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + SpinBox_FX->RangeStepAndValidator(1.e-6, 1.e+6, 1.0, "parametric_precision"); 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_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); RadioButton1->setChecked(true); diff --git a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx index 1cab8d3f4..d0d6365a6 100644 --- a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx @@ -229,7 +229,7 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule ) SpinBox_IterationLimit->setRange(1, 999999); 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); GroupArguments->show(); diff --git a/src/SMESHGUI/SMESHGUI_SpinBox.cxx b/src/SMESHGUI/SMESHGUI_SpinBox.cxx index c617f5ec7..13b84b813 100644 --- a/src/SMESHGUI/SMESHGUI_SpinBox.cxx +++ b/src/SMESHGUI/SMESHGUI_SpinBox.cxx @@ -26,9 +26,12 @@ // #include "SMESHGUI_SpinBox.h" +#include +#include + // Qt includes -#include #include +#include //================================================================================= // class : SMESHGUI_SpinBox() @@ -93,15 +96,6 @@ QLineEdit* SMESHGUI_SpinBox::editor() const return SalomeApp_DoubleSpinBox::lineEdit(); } -//================================================================================= -// function : validator() -// purpose : returns validator -//================================================================================= -QDoubleValidator* SMESHGUI_SpinBox::validator() const -{ - return (QDoubleValidator*)editor()->validator(); -} - //================================================================================= // function : RangeStepAndValidator() // purpose : @@ -109,12 +103,22 @@ QDoubleValidator* SMESHGUI_SpinBox::validator() const void SMESHGUI_SpinBox::RangeStepAndValidator( double min, double max, double step, - unsigned short precision ) + const char* quantity ) { - setPrecision(precision*(-1)); // PAL8769. Minus is for using 'g' double->string conversion specifier, - // see QtxDoubleSpinBox::mapValueToText( double v ) - setDecimals(32); + // 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 ) + // san: this can be achieved using preferences + setDecimals(qAbs(precision)); setRange(min, max); setSingleStep( step ); 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 ) ) ); } diff --git a/src/SMESHGUI/SMESHGUI_SpinBox.h b/src/SMESHGUI/SMESHGUI_SpinBox.h index aa757ee63..3b92c409f 100644 --- a/src/SMESHGUI/SMESHGUI_SpinBox.h +++ b/src/SMESHGUI/SMESHGUI_SpinBox.h @@ -54,12 +54,11 @@ public: void RangeStepAndValidator( double = -1000000.0, double = +1000000.0, double = 100.0, - unsigned short = 3 ); + const char* = "length_precision" ); void SetValue( double ); double GetValue() const; QString GetString() const; QLineEdit* editor() const; - QDoubleValidator* validator() const; public slots: void SetStep( double ); diff --git a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx index 5da44a6ae..cf863ff4a 100644 --- a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx @@ -261,12 +261,12 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule ) SMESHGUI_SymmetryDlgLayout->addWidget(GroupButtons); /* Initialisations */ - SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - SpinBox_Y->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - SpinBox_DZ->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, "length_precision"); + SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); RadioButton1->setChecked(true); diff --git a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx index 97d5ca582..354176e92 100644 --- a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx @@ -266,12 +266,12 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule ) SMESHGUI_TranslationDlgLayout->addWidget(GroupButtons); /* Initialisations */ - SpinBox1_1->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); - SpinBox1_2->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); - SpinBox1_3->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); - SpinBox2_1->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); - SpinBox2_2->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); - SpinBox2_3->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, "length_precision"); + SpinBox1_3->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + SpinBox2_1->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + SpinBox2_2->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + SpinBox2_3->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); RadioButton1->setChecked(true); diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index ad1ab608b..db205dc00 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -3162,6 +3162,40 @@ Consider saving your work before application crash NO_MESH_SELECTED No mesh selected + + SMESH_PREF_def_precision + Default precision + + + SMESH_PREF_length_precision + Length precision + + + SMESH_PREF_angle_precision + Angular precision + + + SMESH_PREF_len_tol_precision + Length tolerance precision + + + SMESH_PREF_parametric_precision + Parametric precision + + + SMESH_PREF_area_precision + Area precision + + + SMESH_PREF_vol_precision + Volume precision + + + SMESH_PRECISION_HINT + +Input value precision can be adjusted using +'%1' parameter in Mesh module preferences. + SMESHGUI @@ -3242,6 +3276,10 @@ Please, create VTK viewer and try again PREF_NOTIFY_MODE Show a computation result notification + + SMESH_PREF_GROUP_PRECISION + Input fields precision + PREF_GROUP_ELEMENTS Elements @@ -5081,4 +5119,63 @@ It is impossible to read point coordinates from file No concurent submeshes detected + + SMESHGUI_ClippingDlg + + CLIP_PLANES + Clipping planes + + + ROTATION_AROUND_X_Y2Z + Rotation around X (Y to Z): + + + ROTATION_AROUND_Y_X2Z + Rotation around Y (X to Z): + + + ROTATION_AROUND_Z_Y2X + Rotation around Z (Y to X): + + + ROTATION_AROUND_X_Z2Y + Rotation around X (Z to Y): + + + ROTATION_AROUND_Y_Z2X + Rotation around Y (Z to X): + + + ROTATION_AROUND_Z_X2Y + Rotation around Z (X to Y): + + + SHOW_PREVIEW + Show preview + + + AUTO_APPLY + Auto Apply + + + ALONG_XY + || X-Y + + + ALONG_YZ + || Y-Z + + + ALONG_ZX + || Z-X + + + PLANE_NUM + Plane# %1 + + + NO_PLANES + No planes + + diff --git a/src/StdMeshersGUI/StdMeshersGUI_DistrTable.cxx b/src/StdMeshersGUI/StdMeshersGUI_DistrTable.cxx index 18659e787..f0d68a99e 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_DistrTable.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_DistrTable.cxx @@ -25,10 +25,11 @@ // #include "StdMeshersGUI_DistrTable.h" +#include + // Qt incldues #include #include -#include #include #include #include @@ -109,7 +110,7 @@ private: struct EditorData { int r, c; - QDoubleSpinBox* sb; + SMESHGUI_SpinBox* sb; EditorData() { reset(); } void reset() { r = -1; c = -1; sb = 0; } }; @@ -138,7 +139,7 @@ public: void addRow(); void deleteRow(); - void setEditor( int, int, QDoubleSpinBox* ); + void setEditor( int, int, SMESHGUI_SpinBox* ); protected: void closeEditor( QWidget*, QAbstractItemDelegate::EndEditHint ); @@ -176,18 +177,22 @@ createEditor( QWidget* parent, const QStyleOptionViewItem& /*option*/, const QModelIndex& index ) const { - QDoubleSpinBox* sb = new QDoubleSpinBox( parent ); - sb->setFrame(false); - sb->setMinimum( index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ? + SMESHGUI_SpinBox* sb = new SMESHGUI_SpinBox( parent ); + + sb->setAcceptNames(false); // No Notebook variables allowed + double aMin = index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ? myTable->argMinimum( index.row() ) : - myTable->funcMinimum( index.row() ) ); - sb->setMaximum( index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ? + myTable->funcMinimum( index.row() ); + double aMax = index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ? myTable->argMaximum( index.row() ) : - myTable->funcMaximum( index.row() ) ); - sb->setSingleStep( index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ? + myTable->funcMaximum( index.row() ); + double aStep = index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ? myTable->argStep( index.row() ) : - myTable->funcStep( index.row() ) ); - myTable->setEditor( index.row(), index.column(), sb ); + myTable->funcStep( index.row() ); + sb->RangeStepAndValidator( aMin, aMax, aStep, "parametric_precision" ); + sb->setFrame(false); + + myTable->setEditor( index.row(), index.column(), sb ); return sb; } @@ -196,7 +201,7 @@ StdMeshersGUI_DistrTableFrame::SpinBoxDelegate:: setEditorData( QWidget* editor, const QModelIndex& index ) const { QString value = index.model()->data(index, Qt::DisplayRole).toString(); - QDoubleSpinBox* sb = static_cast(editor); + SMESHGUI_SpinBox* sb = static_cast(editor); bool bOk = false; double v = value.toDouble( &bOk ); @@ -210,7 +215,7 @@ StdMeshersGUI_DistrTableFrame::SpinBoxDelegate:: setModelData( QWidget* editor, QAbstractItemModel* model, const QModelIndex& index ) const { - QDoubleSpinBox* sb = static_cast(editor); + SMESHGUI_SpinBox* sb = static_cast(editor); model->setData( index, QString::number( sb->value() ), Qt::DisplayRole ); } @@ -247,7 +252,7 @@ Table( QWidget* parent, int rows ) void StdMeshersGUI_DistrTableFrame::Table:: -setEditor( int r, int c, QDoubleSpinBox* sb ) +setEditor( int r, int c, SMESHGUI_SpinBox* sb ) { myEditorData.r = r; myEditorData.c = c; diff --git a/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx index 2ff99486f..496b81282 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx @@ -25,8 +25,9 @@ // #include "StdMeshersGUI_FixedPointsParamWdg.h" -#include -#include +#include + +#include // Qt includes #include @@ -81,7 +82,8 @@ QWidget* StdMeshersGUI_FixedPointsParamWdg::LineDelegate::createEditor( QWidget* { QWidget* w = 0; 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->setRange( 1, 999); w = sb; @@ -94,8 +96,8 @@ void StdMeshersGUI_FixedPointsParamWdg::LineDelegate::setModelData( QWidget* edi QAbstractItemModel* model, const QModelIndex& index ) const { - model->setData( index, qobject_cast( editor )->value(), Qt::EditRole ); - model->setData( index, qobject_cast( editor )->value(), Qt::UserRole ); + model->setData( index, qobject_cast( editor )->value(), Qt::EditRole ); + model->setData( index, qobject_cast( editor )->value(), Qt::UserRole ); } //================================================================================ @@ -114,7 +116,7 @@ StdMeshersGUI_FixedPointsParamWdg myListWidget = new QListWidget( this ); myTreeWidget = new QTreeWidget( this ); - mySpinBox = new QtxDoubleSpinBox( this ); + mySpinBox = new SMESHGUI_SpinBox( this ); myAddButton = new QPushButton( tr( "SMESH_BUT_ADD" ), this ); myRemoveButton = new QPushButton( tr( "SMESH_BUT_REMOVE" ), this ); mySameValues = new QCheckBox( tr("SMESH_SAME_NB_SEGMENTS"), this); @@ -141,10 +143,8 @@ StdMeshersGUI_FixedPointsParamWdg myListWidget->setMinimumWidth( 80 ); myTreeWidget->setMinimumWidth( 200 ); - mySpinBox->setRange( 0, 1 ); - mySpinBox->setSingleStep( 0.1 ); - mySpinBox->setDecimals( 4 ); - mySpinBox->setPrecision( 4 ); + mySpinBox->setAcceptNames( false ); // No Notebook variables allowed + mySpinBox->RangeStepAndValidator( 0., 1., .1, "parametric_precision" ); myListWidget->setMinimumWidth( 70 ); connect( myAddButton, SIGNAL( clicked() ), SLOT( onAdd() ) ); diff --git a/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.h b/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.h index 273781d34..d7cf63337 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.h +++ b/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.h @@ -34,7 +34,7 @@ #include class SMESHGUI; -class QtxDoubleSpinBox; +class SMESHGUI_SpinBox; class QPushButton; class QLineEdit; class QCheckBox; @@ -84,7 +84,7 @@ private: private: QListWidget* myListWidget; QTreeWidget* myTreeWidget; - QtxDoubleSpinBox* mySpinBox; + SMESHGUI_SpinBox* mySpinBox; QPushButton* myAddButton; QPushButton* myRemoveButton; QCheckBox* mySameValues; diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx index 2ee5473af..8f88698c0 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx @@ -149,7 +149,7 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame() // 3) scale myGroupLayout->addWidget( myLScale = new QLabel( tr( "SMESH_NB_SEGMENTS_SCALE_PARAM" ), GroupC1 ), row, 0 ); 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 ); row++; diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx index fd9413046..0ba7955c7 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx @@ -1028,38 +1028,38 @@ void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int) if( hypType()=="LocalLength" && sb ) { 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")) - 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 ) { - sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 ); + sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "parametric_precision" ); } 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() ); } 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 ) { - 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 ) { - sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 ); + sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" ); } 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 { - sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 ); + sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" ); } }