QLineEdit - Float number not displayed correct
Hi,
I am using QLineEdit to display a Float number.
When setting the the text using setText() then the number is not displayed correct.
For example the number '9.991' is displayed '9 .991', 1 or more spaces before the decimal point! This happens when I set the input mask to ###.###;
I tried other masks like 999.999; but same result. If I don't use a mask then it is displayed correct but then the user can enter alfanumeric characters!
I hope someone can help me on this.
Regards,
Morty
Re: QLineEdit - Float number not displayed correct
Have you tried without input mask and with a double validator instead?
Code:
// bottom (-999.0), top (999.0), decimals (2)
Re: QLineEdit - Float number not displayed correct
Hi,
Yes, I did try that.
I just thought it would be neater to prevent the user entering letters. And when it is possible to have a numeric mask that should prevent this, why not use it.
Have I misunderstood the use of the input mask?
Regards,
Morty
Re: QLineEdit - Float number not displayed correct
I made a mistake when setting the QDoubleValidator so I could still enter letters.
Now that I have tried again and got it right I can see that it is only possible to enter numbers.
Problem solved.
Morty