53007 修改wifi密码输入框为按下显示明文松开取消明文

This commit is contained in:
lvhan 2021-05-08 15:08:06 +08:00
parent d2ef240613
commit 200f394899
7 changed files with 50 additions and 32 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

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

View File

@ -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)

View File

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