From a1b138abbd5a6e5a2a77db71aea6dbf9ac46f117 Mon Sep 17 00:00:00 2001 From: zhangyuanyuan1 Date: Thu, 30 Jun 2022 14:58:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=83=AD=E7=82=B9=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E8=BE=93=E5=85=A5ui=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/mobilehotspot/mobilehotspotwidget.cpp | 23 ++++++++++++------- plugins/mobilehotspot/mobilehotspotwidget.h | 2 ++ src/frontend/tab-pages/wlanpage.cpp | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/plugins/mobilehotspot/mobilehotspotwidget.cpp b/plugins/mobilehotspot/mobilehotspotwidget.cpp index c4801edb..83b1bacf 100644 --- a/plugins/mobilehotspot/mobilehotspotwidget.cpp +++ b/plugins/mobilehotspot/mobilehotspotwidget.cpp @@ -15,7 +15,7 @@ #define LINE_MAX_SIZE 16777215, 1 #define LINE_MIN_SIZE 0, 1 #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_ITEM_MARGINS 16, 12, 16, 14 @@ -114,7 +114,7 @@ bool MobileHotspotWidget::eventFilter(QObject *watched, QEvent *event) return true; } 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; } showDesktopNotify(tr("start to open hotspot ") + m_apNameLine->text()); @@ -130,12 +130,6 @@ bool MobileHotspotWidget::eventFilter(QObject *watched, QEvent *event) } 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); } @@ -207,6 +201,7 @@ void MobileHotspotWidget::initDbusConnect() } connect(m_apNameLine, &QLineEdit::textEdited, this, &MobileHotspotWidget::onApLineEditTextEdit); + connect(m_pwdNameLine, SIGNAL(textChanged(QString)), this, SLOT(onPwdTextChanged())); } void MobileHotspotWidget::onApLineEditTextEdit(QString text) @@ -224,6 +219,18 @@ void MobileHotspotWidget::onApLineEditTextEdit(QString text) 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) { diff --git a/plugins/mobilehotspot/mobilehotspotwidget.h b/plugins/mobilehotspot/mobilehotspotwidget.h index f525c409..668f3052 100644 --- a/plugins/mobilehotspot/mobilehotspotwidget.h +++ b/plugins/mobilehotspot/mobilehotspotwidget.h @@ -116,6 +116,8 @@ private slots: void onApLineEditTextEdit(QString text); + void onPwdTextChanged(); + }; #endif // MOBILEHOTSPOTWIDGET_H diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index 6826f178..4595d5a0 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -124,8 +124,8 @@ void WlanPage::onWlanSwithGsettingsChanged(const QString &key) qDebug() << LOG_FLAG << "wlan switch state" << m_wlanSwitchEnable; if (m_wirelessConnectOpreation->getWirelessEnabled() != m_wlanSwitchEnable) { + // 根据Gsetting更新开关状态 m_wirelessConnectOpreation->setWirelessEnabled(m_wlanSwitchEnable); - qDebug() <<"wlan switch state!="; } m_netSwitch->setChecked(m_wlanSwitchEnable);