[Kst] Re: branches/work/kst/portto4/kst/src/libkst

Peter Kümmel syntheticpp at gmx.net
Sun Feb 6 10:17:42 CET 2011


On 05.02.2011 23:34, Nicolas Brisset wrote:
> SVN commit 1219047 by brisset:
>
> Avoid adding square brackets around the unit if it already has some
>
>
>   M  +5 -0      datavector.cpp
>
>
> --- branches/work/kst/portto4/kst/src/libkst/datavector.cpp #1219046:1219047
> @@ -315,9 +315,14 @@
>     if (_fieldStrings.contains("units")) {
>       QString units = _fieldStrings.value("units")->value();
>       if (!units.isEmpty()) {
> +      // Apparently some people already add the square brackets in the unit name - avoid having two brackets
> +      if (units.startsWith("[")) {
> +        label += " " + units;
> +      } else {
>         label += " \\[" + units + "\\]";
>       }
>     }
> +  }


I would fix a buggy string:

       if (units.startsWith("[")) {
         label += " " + units;
+        if (!label.endsWith("]")) {
+          label += "\\]";
+        }


But should I add "]" or "\\]"?

Peter


More information about the Kst mailing list