QRegExp regx("[a-zA-Z0-9]+$"); QValidator *validator = new QRegExpValidator(regx, lined ); lined->setValidator( validator );