QValidator for floating point with optional % sign at the end
-
I've got an entry field which is effectively for a double, but should allow the use of a % sign at the end. IOW it should allow:
1234.56
or
99.95%
If it has a percent sign the range should be 0-99.99.
If not in UK/US then allow , as decimal seperator.
QDoubleValidator covers all except the use of %ages
Is it possible to write a regex that allows arbitrary length b4 decimal part and two decimal places, OR two digits before decimal part and two decimal places followed by %?
You may gather correctly that I'm not a heavy user of RegExs
D.
-
Don't use a regexp but analyze your entered string 'manually' by trying to convert it do a double and remove the percent sign before if it's at the end.