From 851a66da48aebd0d1b159e1e84a212559263e86d Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 20 Sep 2010 07:22:59 +0000 Subject: [PATCH] 0020979: EDF 1168 GEOM: non coherence of display of decimal values --- src/BasicGUI/BasicGUI_PointDlg.cxx | 6 +++--- src/DlgRef/DlgRef.cxx | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx index ef68dfb54..aae91ce3b 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.cxx +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -899,9 +899,9 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects ) if ( GEOMBase::GetShape( anObj, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) { gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); - myX->setText( QString( "%1" ).arg( aPnt.X() ) ); - myY->setText( QString( "%1" ).arg( aPnt.Y() ) ); - myZ->setText( QString( "%1" ).arg( aPnt.Z() ) ); + myX->setText( DlgRef::PrintDoubleValue( aPnt.X() ) ); + myY->setText( DlgRef::PrintDoubleValue( aPnt.Y() ) ); + myZ->setText( DlgRef::PrintDoubleValue( aPnt.Z() ) ); } else { myX->setText( "" ); diff --git a/src/DlgRef/DlgRef.cxx b/src/DlgRef/DlgRef.cxx index d3a0bc5ec..94c2ece07 100644 --- a/src/DlgRef/DlgRef.cxx +++ b/src/DlgRef/DlgRef.cxx @@ -781,13 +781,12 @@ QString DlgRef::PrintDoubleValue( double theValue, int thePrecision ) if ( qAbs(theValue) < prec ) return "0"; - QString aRes; - aRes.setNum( theValue, 'g', thePrecision ); + QString aRes = QLocale().toString( theValue, 'g', qAbs( thePrecision ) ); if ( prec > 0 ) { int p = 0; while ( p < thePrecision ) { - aRes.setNum( theValue, 'g', p++ ); + QString aRes = QLocale().toString( theValue, 'g', qAbs( p++ ) ); double v = aRes.toDouble(); double err = qAbs( theValue - v ); if ( err > 0 && err <= prec ) @@ -796,7 +795,7 @@ QString DlgRef::PrintDoubleValue( double theValue, int thePrecision ) } // remove trailing zeroes - QString delim( "." ); + QString delim( QLocale().decimalPoint() ); int idx = aRes.lastIndexOf( delim ); if ( idx == -1 )