Closed hamoid closed 6 years ago
indeed a strange behaviour. If the type of variable a in your example is changed to a float and the decimalPrecision is set to 0, the number is displayed correctly, however if it is a int, the last digit goes missing. I am not able to fix this without being sure to cause another unexpected behaviour, hence I wont fix this.
If you work with values of type int, I assume that the precision does not have to be set and the problem of the missing last digit does not occur.
So if anyone finds this thread in the future: don't set decimalPrecision to 0 on integers :)
In my case I can do something like if(requestedDecimalPrecision > 0) { slider.setDecimalPrecision(requestedDecimalPrecision); }
In this example, the range becomes 0 .. 10000 instead of 0 .. 100000 (one zero missing).
If I remove the
int a
variable declaration it works fine. If I set the decimal precision to 1 it also works fine. I'm using an automatic control panel generator which sets the precision for each variable, and it sounds logical to me to set it to 0 for ints, but it breaks the behavior.