我现设计了一个LineEdit 两个checkBox 我想通过判断用户选择checkBox的情况 来设定QRegExp regExp。
我的代码如下:
setupUi (this);
if(checkBox->isChecked())
QRegExp regExp("[0-9][0-9][0-9][0-9][0-9]");
else if(checkBox_2->isChecked())
QRegExp regExp("[0-9][0-9]");
else
QRegExp regExp("");
lineEdit->setValidator (new QRegExpValidator (regExp, this));
错误: ‘regExp’在此作用域中尚未声明
这个应该怎么改呢?(有点急)