移动热点密码输入ui调整

This commit is contained in:
zhangyuanyuan1 2022-06-30 14:58:47 +08:00
parent b490f07c5a
commit a1b138abbd
3 changed files with 18 additions and 9 deletions

View File

@ -15,7 +15,7 @@
#define LINE_MAX_SIZE 16777215, 1 #define LINE_MAX_SIZE 16777215, 1
#define LINE_MIN_SIZE 0, 1 #define LINE_MIN_SIZE 0, 1
#define ICON_SIZE 24,24 #define ICON_SIZE 24,24
#define PASSWORD_FRAME_MIN_SIZE 550, 86 #define PASSWORD_FRAME_MIN_SIZE 550, 60
#define PASSWORD_FRAME_MAX_SIZE 16777215, 86 #define PASSWORD_FRAME_MAX_SIZE 16777215, 86
#define PASSWORD_ITEM_MARGINS 16, 12, 16, 14 #define PASSWORD_ITEM_MARGINS 16, 12, 16, 14
@ -114,7 +114,7 @@ bool MobileHotspotWidget::eventFilter(QObject *watched, QEvent *event)
return true; return true;
} }
if (m_pwdNameLine->text().length() < 8) { if (m_pwdNameLine->text().length() < 8) {
showDesktopNotify(tr("can not create hotspot with password length less than eight!")); // showDesktopNotify(tr("can not create hotspot with password length less than eight!"));
return true; return true;
} }
showDesktopNotify(tr("start to open hotspot ") + m_apNameLine->text()); showDesktopNotify(tr("start to open hotspot ") + m_apNameLine->text());
@ -130,12 +130,6 @@ bool MobileHotspotWidget::eventFilter(QObject *watched, QEvent *event)
} }
return true; return true;
} }
} else if (watched == m_pwdNameLine) {
if (m_pwdNameLine->text().length() < 8) {
m_pwdHintLabel->setText(tr("Contains at least 8 characters")); //至少包含8个字符
} else {
m_pwdHintLabel->clear();
}
} }
return QWidget::eventFilter(watched, event); return QWidget::eventFilter(watched, event);
} }
@ -207,6 +201,7 @@ void MobileHotspotWidget::initDbusConnect()
} }
connect(m_apNameLine, &QLineEdit::textEdited, this, &MobileHotspotWidget::onApLineEditTextEdit); connect(m_apNameLine, &QLineEdit::textEdited, this, &MobileHotspotWidget::onApLineEditTextEdit);
connect(m_pwdNameLine, SIGNAL(textChanged(QString)), this, SLOT(onPwdTextChanged()));
} }
void MobileHotspotWidget::onApLineEditTextEdit(QString text) void MobileHotspotWidget::onApLineEditTextEdit(QString text)
@ -224,6 +219,18 @@ void MobileHotspotWidget::onApLineEditTextEdit(QString text)
m_apNameLine->setText(text.left(i)); m_apNameLine->setText(text.left(i));
} }
void MobileHotspotWidget::onPwdTextChanged()
{
if (m_pwdNameLine->text().length() < 8) {
m_pwdHintLabel->show();
m_pwdHintLabel->setText(tr("Contains at least 8 characters")); //至少包含8个字符
} else {
m_pwdHintLabel->clear();
m_pwdHintLabel->hide();
}
}
void MobileHotspotWidget::onActiveConnectionChanged(QString deviceName, QString ssid, QString uuid, int status) void MobileHotspotWidget::onActiveConnectionChanged(QString deviceName, QString ssid, QString uuid, int status)
{ {

View File

@ -116,6 +116,8 @@ private slots:
void onApLineEditTextEdit(QString text); void onApLineEditTextEdit(QString text);
void onPwdTextChanged();
}; };
#endif // MOBILEHOTSPOTWIDGET_H #endif // MOBILEHOTSPOTWIDGET_H

View File

@ -124,8 +124,8 @@ void WlanPage::onWlanSwithGsettingsChanged(const QString &key)
qDebug() << LOG_FLAG << "wlan switch state" << m_wlanSwitchEnable; qDebug() << LOG_FLAG << "wlan switch state" << m_wlanSwitchEnable;
if (m_wirelessConnectOpreation->getWirelessEnabled() != m_wlanSwitchEnable) { if (m_wirelessConnectOpreation->getWirelessEnabled() != m_wlanSwitchEnable) {
// 根据Gsetting更新开关状态
m_wirelessConnectOpreation->setWirelessEnabled(m_wlanSwitchEnable); m_wirelessConnectOpreation->setWirelessEnabled(m_wlanSwitchEnable);
qDebug() <<"wlan switch state!=";
} }
m_netSwitch->setChecked(m_wlanSwitchEnable); m_netSwitch->setChecked(m_wlanSwitchEnable);