]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
SPO: Fix: Function DoubleToQString returns empty string when value = 0.0 and removeZe...
authorsbh <sbh@opencascade.com>
Mon, 24 Dec 2012 07:21:06 +0000 (07:21 +0000)
committersbh <sbh@opencascade.com>
Mon, 24 Dec 2012 07:21:06 +0000 (07:21 +0000)
src/TableViewer/TableViewer_Tool.cxx

index f193b1a3fb50d5aa228d66636b561d860bff2030..9b98e2e350e686fdab4a63f2277fc2bb68aa916a 100755 (executable)
@@ -107,11 +107,13 @@ QString TableViewer_Tool::DoubleToQString( const double value,
     delete aBuf;
     std::string aNewResult = "";
     int aCounter = 0;
-    for ( int jj = aResultStr.size()-1; jj >=aWholePartStr.size(); --jj ) {
-      if ( aResultStr.at(jj) == '0' || aResultStr.at( jj ) == '.' )
-       aCounter++;
-      else
-        break;
+    if ( aResultStr.find( '.' ) != std::string::npos ) {
+      for ( int jj = aResultStr.size()-1; jj >=aWholePartStr.size(); --jj ) {
+        if ( aResultStr.at(jj) == '0' || aResultStr.at( jj ) == '.' )
+          aCounter++;
+        else
+          break;
+      }
     }
     for ( int ii = 0;  ii<aResultStr.size()-aCounter; ii++)
       aNewResult += aResultStr.at( ii );