QLineEdit *lineEdit = new QLineEdit();
QRegExp regExp("^[1-9][0-9]{1,8}$"); //^[1-9][0-9]*$ 任意位数正整数
lineEdit->setValidator(new QRegExpValidator(regExp, this));
QT-QLineEdit输入只允许大于0的整数
最新推荐文章于 2024-05-27 13:55:28 发布
QLineEdit *lineEdit = new QLineEdit();
QRegExp regExp("^[1-9][0-9]{1,8}$"); //^[1-9][0-9]*$ 任意位数正整数
lineEdit->setValidator(new QRegExpValidator(regExp, this));