PDA

View Full Version : How to set QLineEdit to accept only ASCII...



cydside
6th December 2011, 11:10
Hi to all,
I'd like to set a QLineEdit object to accept only ASCII chars without use inputMask because I should set a 'N' for 128 times(buffer lenght). Is there a simple way to do that?
Thanks.

Lesiok
6th December 2011, 15:19
Use QRegExpValidator.

ChrisW67
6th December 2011, 22:51
The 'N' validator character doesn't meet your requirement anyway. For example, it will not allow punctuation like comma, parentheses, semi-colon etc., which are clearly ASCII characters.

cydside
7th December 2011, 08:55
Thanks, I'll try QLineEdit->text().toASCII(); function.