用Qt 怎么实现某个linEdit文本框只能输入正整数? 先谢了~~
------解决方案--------------------
- C/C++ code
QRegExp regExp2("[0-9]{1,4}"); QRegExpValidator *pRegExpValidator2 = new QRegExpValidator(regExp2,this); myEdit->setValidator(pRegExpValidator2);
QRegExp regExp2("[0-9]{1,4}"); QRegExpValidator *pRegExpValidator2 = new QRegExpValidator(regExp2,this); myEdit->setValidator(pRegExpValidator2);