I have a QLineEdit in a dialog box I am creating that allows entering an IP address. I have used a QRegExp validator to ensure that it takes the form:
"[0-2][0-9][0-9][.][0-2][0-9][0-9][.][0-2][0-9][0-9][.][0-2][0-9][0-9]"
(I know I need some improvement with regular expressions...)
This works ok but I still need to range check so each of the four values are within 0-255.
Can multiple validators be applied to the same widget?
Or, am I going about this all wrong?
I was thinking it might be better to break down the QLineEdit into four separate ones, use the range checking of a QIntValidator and then convert to one single QString after it is valid?
Bookmarks