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();