double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
/* min, max, step and decimals for spin boxes */
- GroupXYZ->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3);
- GroupXYZ->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3);
- GroupXYZ->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3);
+ GroupXYZ->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
+ GroupXYZ->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
+ GroupXYZ->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupXYZ->SpinBox_DX->SetValue(0.0);
GroupXYZ->SpinBox_DY->SetValue(0.0);
GroupXYZ->SpinBox_DZ->SetValue(0.0);
- GroupRefPoint->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3);
- GroupRefPoint->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3);
- GroupRefPoint->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3);
+ GroupRefPoint->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
+ GroupRefPoint->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
+ GroupRefPoint->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupRefPoint->SpinBox_DX->SetValue(0.0);
GroupRefPoint->SpinBox_DY->SetValue(0.0);
GroupRefPoint->SpinBox_DZ->SetValue(0.0);
step = 0.1;
- GroupOnCurve->SpinBox_DX->RangeStepAndValidator(0., 1., step, 3);
+ GroupOnCurve->SpinBox_DX->RangeStepAndValidator(0., 1., step, DBL_DIGITS_DISPLAY);
GroupOnCurve->SpinBox_DX->SetValue( 0.5 );
/* signals and slots connections */
setLineStep(step);
((QDoubleValidator*)validator())->setRange(min, max, decimals);
}
+
+QString DlgRef_SpinBox::PrintDoubleValue (double theValue, int thePrecision)
+{
+ QString aRes;
+ aRes.setNum(theValue, 'g', thePrecision);
+
+ // remove trailing zeroes
+ QString delim( "." );
+
+ int idx = aRes.findRev( delim );
+ if ( idx == -1 )
+ return aRes;
+
+ QString iPart = aRes.left( idx );
+ QString fPart = aRes.mid( idx + 1 );
+
+ while ( !fPart.isEmpty() && fPart.at( fPart.length() - 1 ) == '0' )
+ fPart.remove( fPart.length() - 1, 1 );
+
+ aRes = iPart;
+ if ( !fPart.isEmpty() )
+ aRes += delim + fPart;
+
+ return aRes;
+}
#define GEOMSPINBOX_H
#include "QtxDblSpinBox.h"
-//#if defined WNT
-//#include <SALOME_WNT.hxx>
-//#else
-//#define SALOME_WNT_EXPORT
-//#endif
+
#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS
#define DLGREF_WNT_EXPORT __declspec( dllexport )
#else
#define COORD_MIN -1e+15
#define COORD_MAX +1e+15
#define MAX_NUMBER 100000
+#define DBL_DIGITS_DISPLAY 16
//=================================================================================
// class : DlgRef_SpinBox
void SetValue(double v);
double GetValue();
QString GetString();
+
+ static QString PrintDoubleValue (double theValue, int Precision = DBL_DIGITS_DISPLAY);
public slots:
void SetStep(double newStep);
-
};
#endif // GEOMSPINBOX_H
#include "MeasureGUI_PointDlg.h"
#include "GEOMBase.h"
+#include "DlgRef_SpinBox.h"
+
#include "utilities.h"
+
#include "SUIT_Session.h"
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
{
gp_Pnt aPnt = BRep_Tool::Pnt( aPoint );
mySelEdit->setText( aName );
- myX->setText( QString( "%1" ).arg( aPnt.X() ) );
- myY->setText( QString( "%1" ).arg( aPnt.Y() ) );
- myZ->setText( QString( "%1" ).arg( aPnt.Z() ) );
+ myX->setText(DlgRef_SpinBox::PrintDoubleValue(aPnt.X()));
+ myY->setText(DlgRef_SpinBox::PrintDoubleValue(aPnt.Y()));
+ myZ->setText(DlgRef_SpinBox::PrintDoubleValue(aPnt.Z()));
}
}
catch( ... )