zoukankan      html  css  js  c++  java
  • Qt正则表达式限制输入

    中文匹配:

        QRegExp reg("^[u4e00-u9fa5]+$");
        QValidator*validator = new QRegExpValidator(reg);
        ui->lineEdit->setValidator(validator);
    

    字母数字匹配:

        QRegExp reg("^[a-zA-Z0-9]+$");
        QValidator*validator = new QRegExpValidator(reg);
        ui->lineEdit->setValidator(validator);
    

    IP、Port、Channel匹配:

    QRegExp regExpIP("((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])[\.]){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])");
    QRegExp regExpNetPort("((6553[0-5])|[655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[0-9])");
    QRegExp regExpChannel("[0-5]");
    
    ui->lineEdit_IP->setValidator(new QRegExpValidator(regExpIP));
    ui->lineEdit_NetPort->setValidator(new QRegExpValidator(regExpNetPort));
    ui->lineEdit_Channel->setValidator(new QRegExpValidator(regExpChannel));
    

      

  • 相关阅读:
    国产html编辑器
    豆瓣90mhz电台还行
    购物搜索
    linode vps 优化集锦
    这个系统,我看行,
    代理网站
    合理设置域名TTL值给网站加速
    dns切换到dnspod
    elixir usage
    JSSH介绍
  • 原文地址:https://www.cnblogs.com/wisdomroc/p/12123552.html
Copyright © 2011-2022 走看看