qt/LedOK/wDevicesManager/inputpassworddialog.cpp
2022-01-04 18:11:48 +08:00

64 lines
2.8 KiB
C++

#include "inputpassworddialog.h"
#include "ui_inputpassworddialog.h"
#include "QPushButton"
#include "LoUIClass/changepasswordform.h"
InputPasswordDialog::InputPasswordDialog(QWidget *parent,int iBackgroundType) :
LoQDialog(parent),
ui(new Ui::InputPasswordDialog)
{
ui->setupUi(this);
if(iBackgroundType==1)
{
setStyleSheet("background-color: #F5F5F5;");
ui->buttonBox->button(QDialogButtonBox::Ok)->setStyleSheet("color: #000000;");
ui->buttonBox->button(QDialogButtonBox::Cancel)->setStyleSheet("color: #000000;");
ui->buttonBox->button(QDialogButtonBox::Ok)->setProperty("ssType", "progManageTool");
ui->buttonBox->button(QDialogButtonBox::Ok)->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
ui->buttonBox->button(QDialogButtonBox::Cancel)->setProperty("ssType", "progManageTool");
ui->buttonBox->button(QDialogButtonBox::Cancel)->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
}
else if(iBackgroundType==2)
{
setStyleSheet("background-color: #D8D8D8;");
ui->lineEdit->setStyleSheet("background-color: #FFFFFF;");
ui->buttonBox->button(QDialogButtonBox::Ok)->setStyleSheet("color: #000000;");
ui->buttonBox->button(QDialogButtonBox::Cancel)->setStyleSheet("color: #000000;");
ui->buttonBox->button(QDialogButtonBox::Ok)->setProperty("ssType", "progManageTool");
ui->buttonBox->button(QDialogButtonBox::Ok)->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
ui->buttonBox->button(QDialogButtonBox::Cancel)->setProperty("ssType", "progManageTool");
ui->buttonBox->button(QDialogButtonBox::Cancel)->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
ui->pushButtonModifiedPassword->setProperty("ssType", "progManageTool");
ui->pushButtonModifiedPassword->setStyleSheet("QPushButton{color:rgba(28,154,210,1);}");
}
ui->lineEdit->setEchoMode(QLineEdit::Password);
ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("OK"));
ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel"));
connect(this, SIGNAL(accepted()), this, SLOT(onAccepted()));
connect(ui->pushButtonModifiedPassword, SIGNAL(clicked()), this, SLOT(OnChangePsPro()));
this->setFocus();
ui->lineEdit->setFocus();
ui->pushButtonModifiedPassword->setVisible(false);
}
InputPasswordDialog::~InputPasswordDialog()
{
delete ui;
}
void InputPasswordDialog::onAccepted()
{
emit sigAcceptData(ui->lineEdit->text());
}
void InputPasswordDialog::ShowChangePassword()
{
ui->pushButtonModifiedPassword->setVisible(true);
}
void InputPasswordDialog::OnChangePsPro()
{
ChangePasswordForm *dlg=new ChangePasswordForm(this);
dlg->setWindowModality(Qt::WindowModal);
dlg->exec();
}