小编use*_*880的帖子

使用TextInput的IP地址掩码

我正在尝试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)

regex ip validation qt qml

5
推荐指数
1
解决办法
2258
查看次数

标签 统计

ip ×1

qml ×1

qt ×1

regex ×1

validation ×1