From: vsr Date: Mon, 1 Aug 2011 10:59:54 +0000 (+0000) Subject: Integrate patch for 0021101: [CEA 439] QtxSpinBox in scientific notation X-Git-Tag: V5_1_6~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6d3754bc8af154f2c8bef624ed8d966963b4c4a5;p=modules%2Fgui.git Integrate patch for 0021101: [CEA 439] QtxSpinBox in scientific notation --- diff --git a/src/Qtx/QtxDoubleSpinBox.cxx b/src/Qtx/QtxDoubleSpinBox.cxx index e4c7df127..00eb9206f 100644 --- a/src/Qtx/QtxDoubleSpinBox.cxx +++ b/src/Qtx/QtxDoubleSpinBox.cxx @@ -258,13 +258,19 @@ QString QtxDoubleSpinBox::removeTrailingZeroes( const QString& src ) const QString iPart = src.left( idx ); QString fPart = src.mid( idx + 1 ); + QString ePart = ""; + int idx1 = fPart.lastIndexOf( QRegExp( "e[+|-]?[0-9]+" ) ); + if ( idx1 >= 0 ) { + ePart = fPart.mid( idx1 ); + fPart = fPart.left( idx1 ); + } - while ( !fPart.isEmpty() && fPart.at( fPart.length() - 1 ) == '0' ) - fPart.remove( fPart.length() - 1, 1 ); + fPart.remove( QRegExp( "0+$" ) ); QString res = iPart; if ( !fPart.isEmpty() ) res += delim + fPart; + res += ePart; return res; }