qt/LedOK/passwordindlg.cpp

38 lines
1.4 KiB
C++
Raw Normal View History

2023-04-18 14:14:46 +08:00
#include "passwordindlg.h"
#include "base/changepasswordform.h"
#include <QVBoxLayout>
#include <QLabel>
#include <QPushButton>
PasswordInChDlg::PasswordInChDlg(QWidget *parent) : BaseDlg(parent) {
resize(213, 136);
setStyleSheet("QDialog{background-color: #eeeeee;} QLabel{background-color: transparent;}");
auto vBox = new QVBoxLayout(this);
vBox->addStretch();
auto hBox = new QHBoxLayout();
hBox->addWidget(new QLabel(tr("Input password")));
fdPassword = new QLineEdit();
fdPassword->setEchoMode(QLineEdit::Password);
fdPassword->setFocus();
hBox->addWidget(fdPassword);
vBox->addLayout(hBox);
btnChangePassword = new QPushButton(tr("Change Password"));
btnChangePassword->setProperty("ssType", "progManageTool");
vBox->addWidget(btnChangePassword, 0, Qt::AlignRight);
connect(btnChangePassword, &QPushButton::clicked, this, [this]() {
ChangePasswordForm dlg(this);
dlg.exec();
});
vBox->addStretch();
btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal);
btnBox->button(QDialogButtonBox::Ok)->setProperty("ssType", "progManageTool");
btnBox->button(QDialogButtonBox::Cancel)->setProperty("ssType", "progManageTool");
vBox->addWidget(btnBox, 0, Qt::AlignHCenter);
connect(btnBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
vBox->addStretch();
}