输入限制

This commit is contained in:
zhaominyong 2021-12-27 09:44:37 +08:00
parent c3d9dd085b
commit 11d0d3e9bb
2 changed files with 4 additions and 2 deletions

View File

@ -1031,7 +1031,8 @@ void DataBackup::initForthWidget()
editBackupName->setText(m_backupName); editBackupName->setText(m_backupName);
} }
// 支持输入中英文数字和部分字符 // 支持输入中英文数字和部分字符
QRegExp regx("^[\u4e00-\u9fa5a-zA-Z0-9~!@#$%^&*()-_+={}':;'\\[\\].<>/? ]+$"); //其中匹配中文[\u4e00-\u9fa5] // QRegExp regx("^[\u4e00-\u9fa5a-zA-Z0-9~!@#$%^&*()-_+={}':;'\\[\\].<>/? ¥()——;《》‘’:“”、?]+$"); //其中匹配中文[\u4e00-\u9fa5]
QRegExp regx("^[\u4e00-\u9fa5a-zA-Z0-9-@& +():']*$");
QValidator *validator = new QRegExpValidator(regx); QValidator *validator = new QRegExpValidator(regx);
editBackupName->setValidator(validator); editBackupName->setValidator(validator);
// 备份名称错误提示 // 备份名称错误提示

View File

@ -616,7 +616,8 @@ void SystemBackup::initForthWidget()
editBackupName->setMaxLength(100); editBackupName->setMaxLength(100);
editBackupName->setPlaceholderText(QDateTime::currentDateTime().toString("yy-MM-dd hh:mm:ss")); editBackupName->setPlaceholderText(QDateTime::currentDateTime().toString("yy-MM-dd hh:mm:ss"));
// 支持输入中英文数字和部分字符 // 支持输入中英文数字和部分字符
QRegExp regx("^[\u4e00-\u9fa5a-zA-Z0-9~!@#$%^&*()-_+={}':;'\\[\\].<>/? ]+$"); //其中匹配中文[\u4e00-\u9fa5] // QRegExp regx("^[\u4e00-\u9fa5a-zA-Z0-9~!@#$%^&*()-_+={}':;'\\[\\].<>/? ¥()——;《》‘’:“”、?]+$"); //其中匹配中文[\u4e00-\u9fa5]
QRegExp regx("^[\u4e00-\u9fa5a-zA-Z0-9-@& +():']*$");
QValidator *validator = new QRegExpValidator(regx); QValidator *validator = new QRegExpValidator(regx);
editBackupName->setValidator(validator); editBackupName->setValidator(validator);
// 备份名称错误提示 // 备份名称错误提示