I searched (an incredible amount of time) through Qt Documentation and some other documentation online but I can't get an answer.
I'm using a QLineEdit which will take a "C++ class name" (that means it should accept only [a-b](<-uppercase as well), [0-9] and underscore(_). No matter how (blindly) I try to set it up, it doesn't work.
1 m_classDefLayout->addRow("Class Name",m_className);
Because I don't know the data type in your code, I just write a simple sample code.
QRegularExpression rx("^[A-Za-z_][A-za-z0-9]*"); QValidator *validator = new QRegularExpressionValidator(rx, this); ui.lineEdit->setValidator(validator);
If you read below link, you will be accurately understood.