天天看点

如何控制QLineEdit控件输入的内容?

 当前控件名为 lineEdit

  QRegExp rx("([0-9])+([0])");   

  QRegExpValidator *pRevalidotor = new QRegExpValidator(rx,this);

  ui->lineEdit->setValidator(pRevalidotor);

  ui->lineEdit->setMaxLength(3);  //设置lineEdit最大长度

继续阅读