草庐IT

QRegExpValidator

全部标签

c++ - QRegExpValidator 与 QTextEdit

QRegExpValidator可以与QTextEdit小部件一起使用吗?我尝试通过setValidator()来实现,并且还将qtextedit设置为父对象。但它不起作用。 最佳答案 你应该使用virtualQValidator::StateQRegExpValidator::validate(QString&input,int&pos)constorboolQRegExp::exactMatch(constQString&str)const由你自己。这应该不难,您只需要确定从哪里开始验证。