Hi @koliva,
I have fields to set the IP address [...] I validate if those fields are really IP address using regex
Don't do that. QHostAddress::QHostAddress(const QString & address) will do that for you (bool isNull() const).
I need to verify also if the given IP address is valid based on given netmask
Maybe bool QHostAddress::isInSubnet(const QHostAddress & subnet, int netmask) const does what you want.
Btw.: Please don't use special input fields for IPv4 addresses. It's 2015 and all operating systems have IPv6 support. Limiting an application to IPv4 only because of bad GUI design is really stupid.