use*_*880 5 regex ip validation qt qml
我正在尝试TextInput为IP地址创建一个,并且我需要控制范围(0-255)。
我使用了regExp验证器,也使用了inputMask,"000.000.000.000;0"但取消了验证器。
如何创建带有输入掩码的IP验证器?
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"
}
Run Code Online (Sandbox Code Playgroud)