PDA

View Full Version : LineEdit should not accept only zero's



sai_3289
16th February 2013, 07:25
Hi,
I have lineEdit which should accepts only integers and float values,so using QRegExp rxacres( "^[0-9.]*$" ) i controlled it.
Now this lineEdit should not accept only zero's,i mean like this 0 , 000, 00.000 , 0.000
For not accepting 0 or 0000 or 00 i have written some logic and its working fine ,i can write for 0.00 or 00.00.......... But i just want to know by using inbulit methods or through QRegExp can we control this Behaviour or not ...?


Regards
Beginner

Lykurg
16th February 2013, 07:42
Hi,

musn't the "." be escapled? and then simple do ^([0-9]*[1-9]+[0-9\\.]*|[0-9\\.]*[0-9]*[1-9]+[0-9]*)$