Re: label setText value is 0
floatmultiplywith is not defined (= 0 as default I guess...), and did you check if your conversion to float works?
Re: label setText value is 0
Quote:
Originally Posted by
Lykurg
floatmultiplywith is not defined (= 0 as default I guess...), and did you check if your conversion to float works?
Yes . floatmultiplywith is not defined.
I removed the line as below and the conversion is correct:
Code:
labelText->setSuffix(" slices");
So now after removing the line of code as above the labelText value is correct!
Re: label setText value is 0
What did you do to give floatmultiplywith a value?
You are using a QSpinBox (QDoubleSpinBox) which will give an int (or double) when value() is called regardless of the prefix or suffix settings. By grabbing the text() value you get a string including the prefix/suffix when you really want the value. Calling cleanText() would be closer but you still have to manually convert to int/double. In short, if you want a number don't ask for the value as a string.