mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-30 19:30:36 +05:00
0020979: EDF 1168 GEOM: non coherence of display of decimal values
This commit is contained in:
parent
e332fbdfc4
commit
851a66da48
@ -899,9 +899,9 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
|
|||||||
if ( GEOMBase::GetShape( anObj, aShape ) && !aShape.IsNull() &&
|
if ( GEOMBase::GetShape( anObj, aShape ) && !aShape.IsNull() &&
|
||||||
aShape.ShapeType() == TopAbs_VERTEX ) {
|
aShape.ShapeType() == TopAbs_VERTEX ) {
|
||||||
gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
|
gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
|
||||||
myX->setText( QString( "%1" ).arg( aPnt.X() ) );
|
myX->setText( DlgRef::PrintDoubleValue( aPnt.X() ) );
|
||||||
myY->setText( QString( "%1" ).arg( aPnt.Y() ) );
|
myY->setText( DlgRef::PrintDoubleValue( aPnt.Y() ) );
|
||||||
myZ->setText( QString( "%1" ).arg( aPnt.Z() ) );
|
myZ->setText( DlgRef::PrintDoubleValue( aPnt.Z() ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
myX->setText( "" );
|
myX->setText( "" );
|
||||||
|
@ -781,13 +781,12 @@ QString DlgRef::PrintDoubleValue( double theValue, int thePrecision )
|
|||||||
if ( qAbs(theValue) < prec )
|
if ( qAbs(theValue) < prec )
|
||||||
return "0";
|
return "0";
|
||||||
|
|
||||||
QString aRes;
|
QString aRes = QLocale().toString( theValue, 'g', qAbs( thePrecision ) );
|
||||||
aRes.setNum( theValue, 'g', thePrecision );
|
|
||||||
|
|
||||||
if ( prec > 0 ) {
|
if ( prec > 0 ) {
|
||||||
int p = 0;
|
int p = 0;
|
||||||
while ( p < thePrecision ) {
|
while ( p < thePrecision ) {
|
||||||
aRes.setNum( theValue, 'g', p++ );
|
QString aRes = QLocale().toString( theValue, 'g', qAbs( p++ ) );
|
||||||
double v = aRes.toDouble();
|
double v = aRes.toDouble();
|
||||||
double err = qAbs( theValue - v );
|
double err = qAbs( theValue - v );
|
||||||
if ( err > 0 && err <= prec )
|
if ( err > 0 && err <= prec )
|
||||||
@ -796,7 +795,7 @@ QString DlgRef::PrintDoubleValue( double theValue, int thePrecision )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// remove trailing zeroes
|
// remove trailing zeroes
|
||||||
QString delim( "." );
|
QString delim( QLocale().decimalPoint() );
|
||||||
|
|
||||||
int idx = aRes.lastIndexOf( delim );
|
int idx = aRes.lastIndexOf( delim );
|
||||||
if ( idx == -1 )
|
if ( idx == -1 )
|
||||||
|
Loading…
Reference in New Issue
Block a user