qtvalidationqregexpinput-maskqregularexpression

Qt QLineEdit Input Validation


How would one set an input validator on a QLineEdit such that it restricts it to a valid IP address? i.e. x.x.x.x where x must be between 0 and 255.and x can not be empty


Solution

  • The answer is here

    In short: You have to set QRegExpValidator with the appropriate Regular Expression for IP4 adresses.