QRegExp rx = QRegExp("[40]*");
QRegExpValidator* validator = new QRegExpValidator(rx);
QLineEdit* lineEdit = new QLineEdit();
lineEdit->setValidator(validator);