I am trying to create a TextInput
for IP addresses, and I need to control the ranges (0-255
).
I used the regExp
validator, and also an inputMask
of "000.000.000.000;0"
but this canceled the validator.
How can I create an IP validator with an input mask?
TextInput
{
id: myLineEdit
anchors.fill: parent
cursorVisible: true
focus: true
validator:RegExpValidator
{
regExp:/^(([01]?[0-9]?[0-9]|2([0-4][0-9]|5[0-5]))\.){3}([01]?[0-9]?[0-9]|2([0-4][0-9]|5[0-5]))$/
}
inputMask: "000.000.000.000;0"
}
Skip the input mask.
And you should define different components for both IPv4 and IPv6.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With