SL100_FactoryTestTool/FactoryTestTool/SourceCode/Network/PasswordEnrollWindow.h

49 lines
1.4 KiB
C++

// PasswordEnrollWindow.h
#ifndef PASSWORDENROLLWINDOW_H
#define PASSWORDENROLLWINDOW_H
#include <QDialog>
#include <QLineEdit>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
class PasswordEnrollWindow : public QDialog
{
Q_OBJECT
public:
explicit PasswordEnrollWindow(QWidget* parent = nullptr) : QDialog(parent) {
QVBoxLayout* layout = new QVBoxLayout(this);
QLabel* label = new QLabel("请输入要注册的密码:", this);
layout->addWidget(label);
passwordLineEdit = new QLineEdit(this);
layout->addWidget(passwordLineEdit);
QHBoxLayout* buttonLayout = new QHBoxLayout;
QPushButton* okButton = new QPushButton("确认", this);
QPushButton* cancelButton = new QPushButton("取消", this);
buttonLayout->addWidget(okButton);
buttonLayout->addWidget(cancelButton);
layout->addLayout(buttonLayout);
setWindowTitle("输入密码");
resize(300, 110); // 设置对话框的大小
connect(okButton, &QPushButton::clicked, this, &QDialog::accept);
connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject);
}
QString getPassword() const {
return passwordLineEdit->text();
}
private:
QLineEdit* passwordLineEdit;
};
#endif // PASSWORDENROLLWINDOW_H