[Kst] branches/work/kst/portto4/kst/src/plugins/fits/polynomial_unweighted

Nicolas Brisset nicolas.brisset at eurocopter.com
Sun Mar 20 22:44:50 CET 2011


SVN commit 1225428 by brisset:

Beautify a bit the fit label.


 M  +8 -4      fitpolynomial_unweighted.cpp  


--- branches/work/kst/portto4/kst/src/plugins/fits/polynomial_unweighted/fitpolynomial_unweighted.cpp #1225427:1225428
@@ -227,14 +227,18 @@
         if (_outputScalars.contains(paramName)) {
           QString name = _outputScalars[paramName]->Name();
           double value = _outputScalars[paramName]->value();
-          if (i == 0) {
-            str += QString("\n[%1]").arg(name);
-          } else {
             QString sign;
             if (value >= 0) {
               sign = " +";
+          } else {
+            sign = " "; // Just for the space, the "-" is already in the number
             }
-            str += QString("%1 [%2]%3").arg(sign).arg(_outputScalars[paramName]->Name()).arg(paramName);
+          if (i == 0) {
+            str += QString("\n[%1]").arg(name);
+          } else if (i == 1) { // Special case x^1 to x
+            str += QString("%1[%2]x").arg(sign).arg(name);
+          } else {
+            str += QString("%1[%2]%3").arg(sign).arg(name).arg(paramName);
           }
         }
       }


More information about the Kst mailing list