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="max_angle" value="2"/>
<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 name="smesh_help" >
<parameter name="sub_menu" value="%1 module"/>

View File

@ -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" ) );

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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 );

View File

@ -27,14 +27,14 @@
#include "SMESHGUI_Preferences_ColorDlg.h"
#include "SMESHGUI.h"
#include "SMESHGUI_SpinBox.h"
#include "SMESHGUI_Utils.h"
// SALOME GUI includes
#include <SUIT_Desktop.h>
#include <QtxColorButton.h>
#include <QtxDoubleSpinBox.h>
#include <QtxIntSpinBox.h>
#include <VTKViewer_MarkerWidget.h>
#include <SalomeApp_IntSpinBox.h>
// Qt includes
#include <QGroupBox>
@ -43,7 +43,6 @@
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QSpinBox>
#include <QCheckBox>
#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 );

View File

@ -36,10 +36,9 @@
#include <QDialog>
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;
};

View File

@ -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 <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SALOME_ListIO.hxx>
#include <SalomeApp_IntSpinBox.h>
#include <QtxDoubleSpinBox.h>
#include <QtxColorButton.h>
// Qt includes
@ -54,7 +55,6 @@
#include <QLineEdit>
#include <QPushButton>
#include <QRadioButton>
#include <QSpinBox>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QGridLayout>
@ -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 ) );

View File

@ -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;

View File

@ -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);

View File

@ -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_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, 3);
SpinBox_Angle->RangeStepAndValidator(-360.0, +360.0, 5.0, "angle_precision");
myConstructorId = 0;
RadioButton1->setChecked(true);

View File

@ -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);

View File

@ -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();

View File

@ -26,9 +26,12 @@
//
#include "SMESHGUI_SpinBox.h"
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
// Qt includes
#include <QDoubleValidator>
#include <QLineEdit>
#include <QVariant>
//=================================================================================
// 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 ) ) );
}

View File

@ -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 );

View File

@ -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);

View File

@ -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);

View File

@ -3162,6 +3162,40 @@ Consider saving your work before application crash</translation>
<source>NO_MESH_SELECTED</source>
<translation>No mesh selected</translation>
</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>
<name>SMESHGUI</name>
@ -3242,6 +3276,10 @@ Please, create VTK viewer and try again</translation>
<source>PREF_NOTIFY_MODE</source>
<translation>Show a computation result notification</translation>
</message>
<message>
<source>SMESH_PREF_GROUP_PRECISION</source>
<translation>Input fields precision</translation>
</message>
<message>
<source>PREF_GROUP_ELEMENTS</source>
<translation>Elements</translation>
@ -5081,4 +5119,63 @@ It is impossible to read point coordinates from file</translation>
<translation>No concurent submeshes detected</translation>
</message>
</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>

View File

@ -25,10 +25,11 @@
//
#include "StdMeshersGUI_DistrTable.h"
#include <SMESHGUI_SpinBox.h>
// Qt incldues
#include <QItemDelegate>
#include <QTableWidget>
#include <QDoubleSpinBox>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>
@ -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<QDoubleSpinBox*>(editor);
SMESHGUI_SpinBox* sb = static_cast<SMESHGUI_SpinBox*>(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<QDoubleSpinBox*>(editor);
SMESHGUI_SpinBox* sb = static_cast<SMESHGUI_SpinBox*>(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;

View File

@ -25,8 +25,9 @@
//
#include "StdMeshersGUI_FixedPointsParamWdg.h"
#include <QtxIntSpinBox.h>
#include <QtxDoubleSpinBox.h>
#include <SMESHGUI_SpinBox.h>
#include <SalomeApp_IntSpinBox.h>
// Qt includes
#include <QPushButton>
@ -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<QtxIntSpinBox*>( editor )->value(), Qt::EditRole );
model->setData( index, qobject_cast<QtxIntSpinBox*>( editor )->value(), Qt::UserRole );
model->setData( index, qobject_cast<SalomeApp_IntSpinBox*>( editor )->value(), Qt::EditRole );
model->setData( index, qobject_cast<SalomeApp_IntSpinBox*>( 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() ) );

View File

@ -34,7 +34,7 @@
#include <QStringList>
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;

View File

@ -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++;

View File

@ -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" );
}
}