QT __IPAddr控件__操作

  QLineEdit *ipEdit = new QLineEdit();  //先这样,等研究好正则表达式后,自动增加"."操作。
    QRegExp regExp("^(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])[.](\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])[.](\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])[.](\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$");
    ipEdit->setValidator(new QRegExpValidator(regExp, this));
-----------------------------------------------

你可能感兴趣的:(QT __IPAddr控件__操作)