From 200f3948991e0c9ea6e90c44a8d966586b833389 Mon Sep 17 00:00:00 2001 From: lvhan Date: Sat, 8 May 2021 15:08:06 +0800 Subject: [PATCH] =?UTF-8?q?53007=20=E4=BF=AE=E6=94=B9wifi=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E8=BE=93=E5=85=A5=E6=A1=86=E4=B8=BA=E6=8C=89=E4=B8=8B?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=98=8E=E6=96=87=E6=9D=BE=E5=BC=80=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E6=98=8E=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/oneconnform.cpp | 15 +++++++++------ src/oneconnform.h | 6 ++++-- src/wificonfigdialog.cpp | 16 ++++++++++------ src/wificonfigdialog.h | 6 ++++-- src/wpawifidialog.cpp | 17 +++++++++-------- wireless-security/dlghidewifiwpa.cpp | 16 ++++++++++------ wireless-security/dlghidewifiwpa.h | 6 ++++-- 7 files changed, 50 insertions(+), 32 deletions(-) diff --git a/src/oneconnform.cpp b/src/oneconnform.cpp index 4bc41e4e..9766a7f5 100644 --- a/src/oneconnform.cpp +++ b/src/oneconnform.cpp @@ -841,13 +841,16 @@ bool OneConnForm::isWifiConfExist(QString netName) } //设置密码隐藏或可见 -void OneConnForm::on_checkBoxPwd_stateChanged(int arg1) +void OneConnForm::on_checkBoxPwd_pressed() { - if (arg1 == 0) { - ui->lePassword->setEchoMode(QLineEdit::Password); - } else { - ui->lePassword->setEchoMode(QLineEdit::Normal); - } + ui->checkBoxPwd->setChecked(true); + ui->lePassword->setEchoMode(QLineEdit::Normal); +} + +void OneConnForm::on_checkBoxPwd_released() +{ + ui->checkBoxPwd->setChecked(false); + ui->lePassword->setEchoMode(QLineEdit::Password); } void OneConnForm::on_lePassword_textEdited(const QString &arg1) diff --git a/src/oneconnform.h b/src/oneconnform.h index e86a2acb..1d446440 100644 --- a/src/oneconnform.h +++ b/src/oneconnform.h @@ -124,14 +124,16 @@ private slots: void on_btnHideConn_clicked(); - void on_checkBoxPwd_stateChanged(int arg1); - void on_lePassword_textEdited(const QString &arg1); void on_btnInfo_clicked(); void on_btnCancel_clicked(); + void on_checkBoxPwd_pressed(); + + void on_checkBoxPwd_released(); + private: QTimer *waitTimer = nullptr; int waitPage; diff --git a/src/wificonfigdialog.cpp b/src/wificonfigdialog.cpp index c127ac87..1b398edd 100644 --- a/src/wificonfigdialog.cpp +++ b/src/wificonfigdialog.cpp @@ -148,13 +148,17 @@ void WiFiConfigDialog::toConfigWifi() } } -void WiFiConfigDialog::on_checkBoxPwd_stateChanged(int arg1) +//切换密码明文 +void WiFiConfigDialog::on_checkBoxPwd_pressed() { - if (arg1 == 0) { - ui->leWifiPassword ->setEchoMode(QLineEdit::Password); - } else { - ui->leWifiPassword->setEchoMode(QLineEdit::Normal); - } + ui->checkBoxPwd->setChecked(true); + ui->leWifiPassword->setEchoMode(QLineEdit::Normal); +} + +void WiFiConfigDialog::on_checkBoxPwd_released() +{ + ui->checkBoxPwd->setChecked(false); + ui->leWifiPassword ->setEchoMode(QLineEdit::Password); } void WiFiConfigDialog::on_leWifiId_textEdited(const QString &arg1) diff --git a/src/wificonfigdialog.h b/src/wificonfigdialog.h index 4fa19ec7..87275d2d 100644 --- a/src/wificonfigdialog.h +++ b/src/wificonfigdialog.h @@ -31,14 +31,16 @@ private slots: void on_btnOk_clicked(); - void on_checkBoxPwd_stateChanged(int arg1); - void on_leWifiId_textEdited(const QString &arg1); void on_leWiFiName_textEdited(const QString &arg1); void on_leWifiPassword_textEdited(const QString &arg1); + void on_checkBoxPwd_pressed(); + + void on_checkBoxPwd_released(); + private: Ui::WiFiConfigDialog *ui; QGSettings *m_transparency_gsettings = nullptr; diff --git a/src/wpawifidialog.cpp b/src/wpawifidialog.cpp index 8df59e51..afa4c2b5 100644 --- a/src/wpawifidialog.cpp +++ b/src/wpawifidialog.cpp @@ -504,14 +504,15 @@ void WpaWifiDialog::initConnect() { //连接按钮 connect(connectBtn, &QPushButton::clicked, this, &WpaWifiDialog::slot_on_connectBtn_clicked); //显示密码 - connect(pwdShowBtn, &QCheckBox::clicked, this, [ = ]() { - if (pwdShowBtn->isChecked()) { - pwdEditor->setEchoMode(QLineEdit::Normal); - m_pwd4PrivateKeyPWDEditor->setEchoMode(QLineEdit::Normal); - } else { - pwdEditor->setEchoMode(QLineEdit::Password); - m_pwd4PrivateKeyPWDEditor->setEchoMode(QLineEdit::Password); - } + connect(pwdShowBtn, &QCheckBox::pressed, this, [ = ]() { + pwdShowBtn->setChecked(true); + pwdEditor->setEchoMode(QLineEdit::Normal); + m_pwd4PrivateKeyPWDEditor->setEchoMode(QLineEdit::Normal); + }); + connect(pwdShowBtn, &QCheckBox::released, this, [ = ]() { + pwdShowBtn->setChecked(false); + pwdEditor->setEchoMode(QLineEdit::Password); + m_pwd4PrivateKeyPWDEditor->setEchoMode(QLineEdit::Password); }); connect(pwdEditor, &QLineEdit::textChanged, this, &WpaWifiDialog::slot_line_edit_changed); connect(userEditor, &QLineEdit::textChanged, this, &WpaWifiDialog::slot_line_edit_changed); diff --git a/wireless-security/dlghidewifiwpa.cpp b/wireless-security/dlghidewifiwpa.cpp index 98e57ea0..e08af341 100644 --- a/wireless-security/dlghidewifiwpa.cpp +++ b/wireless-security/dlghidewifiwpa.cpp @@ -340,13 +340,17 @@ void DlgHideWifiWpa::on_btnConnect_clicked() // shellProcess->deleteLater(); //} -void DlgHideWifiWpa::on_checkBoxPwd_stateChanged(int arg1) +//切换密码明文 +void DlgHideWifiWpa::on_checkBoxPwd_pressed() { - if (arg1 == 0) { - ui->lePassword ->setEchoMode(QLineEdit::Password); - } else { - ui->lePassword->setEchoMode(QLineEdit::Normal); - } + ui->checkBoxPwd->setChecked(true); + ui->lePassword->setEchoMode(QLineEdit::Normal); +} + +void DlgHideWifiWpa::on_checkBoxPwd_released() +{ + ui->checkBoxPwd->setChecked(false); + ui->lePassword->setEchoMode(QLineEdit::Password); } void DlgHideWifiWpa::on_leNetName_textEdited(const QString &arg1) diff --git a/wireless-security/dlghidewifiwpa.h b/wireless-security/dlghidewifiwpa.h index eff23dd8..0e599fa2 100644 --- a/wireless-security/dlghidewifiwpa.h +++ b/wireless-security/dlghidewifiwpa.h @@ -54,14 +54,16 @@ private slots: void on_btnConnect_clicked(); - void on_checkBoxPwd_stateChanged(int arg1); - void on_leNetName_textEdited(const QString &arg1); void on_lePassword_textEdited(const QString &arg1); // void finishedProcess(int res); + void on_checkBoxPwd_pressed(); + + void on_checkBoxPwd_released(); + signals: void reSetWifiList(); void stopSignal();