Qt articles - the input box dialog box prohibits the input of Chinese

When creating a standard input box dialog box, the prohibition of inputting Chinese in the input box can be set as follows. Among them, the Qt::ImhHiddenText attribute allows us to block the use of Chinese input methods when pressing the button in the input box.

QInputDialog *inputDialog = new QInputDialog(this);
bool getInfo;
QString password = inputDialog->getText(this,"管理员登录","请输入管理员密码",
QLineEdit::Password,"",&getInfo,Qt::WindowFlags(0),Qt::ImhHiddenText);
if(getInfo) {
    //确定
}else {
    //取消/关闭
}

Guess you like

Origin blog.csdn.net/u011391361/article/details/128804386