fix(生僻字):使用validator限制字符长度(#185510)

This commit is contained in:
jzxc95 2023-08-11 16:09:35 +08:00
parent 6027099c04
commit af838bb79f
3 changed files with 11 additions and 3 deletions

View File

@ -33,7 +33,6 @@ CreatNetPage::CreatNetPage(QWidget *parent):QFrame(parent)
void CreatNetPage::initUI()
{
connNameEdit = new LineEdit(this);
connNameEdit->setMaxLength(MAX_NAME_LENGTH);
ipv4ConfigCombox = new QComboBox(this);
ipv4addressEdit = new LineEdit(this);
netMaskEdit = new LineEdit(this);
@ -109,6 +108,10 @@ void CreatNetPage::initUI()
ipv4ConfigCombox->addItem(tr("Auto(DHCP)"), AUTO_CONFIG); //"自动(DHCP)"
ipv4ConfigCombox->addItem(tr("Manual"), MANUAL_CONFIG); //"手动"
QRegExp nameRx("^.{0,32}$");
QValidator *validator = new QRegExpValidator(nameRx, this);
connNameEdit->setValidator(validator);
ipv4addressEdit->setValidator(new QRegExpValidator(rx, this));
gateWayEdit->setValidator(new QRegExpValidator(rx, this));
netMaskEdit->setValidator(new QRegExpValidator(rx, this));

View File

@ -245,7 +245,10 @@ void DetailPage::initUI() {
m_SSIDEdit->setAlignment(Qt::AlignRight);
m_SSIDEdit->setStyleSheet("border-top:0px solid;border-bottom:1px solid;border-left:0px solid;border-right: 0px solid;background:transparent");
m_SSIDEdit->setPlaceholderText(tr("Please input SSID:"));
m_SSIDEdit->setMaxLength(MAX_NAME_LENGTH);
QRegExp nameRx("^.{0,32}$");
QValidator *validator = new QRegExpValidator(nameRx, this);
m_SSIDEdit->setValidator(validator);
m_ssidWidget = new DetailWidget(qobject_cast<QWidget *>(m_SSIDEdit), m_listWidget);
}

View File

@ -147,7 +147,9 @@ void JoinHiddenWiFiPage::initUI()
m_cancelBtn->setText(tr("Cancel"));
m_joinBtn->setText(tr("Join"));
m_nameEdit->setMaxLength(MAX_NAME_LENGTH);
QRegExp nameRx("^.{0,32}$");
QValidator *validator = new QRegExpValidator(nameRx, this);
m_nameEdit->setValidator(validator);
m_nameEdit->setPlaceholderText(tr("Required")); //必填
this->setWindowTitle(tr("Find and Join WLAN"));