Question

I have a QLineEdit control, and wanna set validator for it.

QRegExp regExp("[A-Za-z0-9]+");
QRegExpValidator *regExpVal = new QRegExpValidator();
regExpVal->setRegExp (regExp);
ui->lineEditName->setValidator (regExpVal);

After do that, I cant type any alphanumeric character on lineEditName and lineEditAlias with Vietnamese keyboard. Qt always clear the character I've input. How can I fix this ?

Was it helpful?

Solution

You are trying to write those character which are not allowed to be entered into the conrtrol as per the regular expression. Either remove the regular expression or reset as per your countries script.

Set QValidator::setLocale for vietnamese.And then set the regex to include vietnamese.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top