PDA

View Full Version : Regular expression in QLineEdit?



vishal.chauhan
1st October 2007, 11:16
Hi All,

I m using Qt 4.1.5 on MAC.
I have a QLineEdit and i enter some value in this.
I want that this Line Edit sould only accepts value between 0-9 and A-F and a-f that is only Hex value from 0-F.

If some one know how to do that then plz help me.

Thanks.

wysota
1st October 2007, 11:19
You can apply a QRegExpValidator on the line edit. Or use QwwLineEdit (http://www.wysota.eu.org/wwwidgets).

vishal.chauhan
1st October 2007, 11:29
Thanks for Reply.

Actually I have tried to set regular expression but not getting much sucess.
Can u plz tell me what should I set in regular expression to get the result.

wysota
1st October 2007, 11:58
QRegExp("[0-9A-Fa-f]+") is the simplest one possible.