PDA

View Full Version : Validator



tinysoft
11th April 2011, 19:22
hi every one

i want to make a validator for all letters and digits BUT ( ' ) and set maximum input to 10 .

PS.
the input letter could be Arabic.

regards

viulskiez
11th April 2011, 21:51
See QRegExpValidator documentation.

tinysoft
13th April 2011, 12:18
i tried to do it from the documentation but i didn't find what i need.

i just want to block the ' form being written and make maximum number of letter to be 10.

viulskiez
13th April 2011, 13:14
To set max input, if you are using QLineEdit, use setMaLength(10).
set the validator with QRegExpValidator and the pattern would be look like "[^']" means doesn't accept single quote.
Try to create your own code.

tinysoft
13th April 2011, 13:28
i wrote it this way "[^']{1,10}" and it worked fine.

thank you for your support.

viulskiez
13th April 2011, 16:00
Well, that's similar. You are smart! :)