50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
#ifndef DELUSERWINDOW_H
|
|
#define DELUSERWINDOW_H
|
|
|
|
#include <QDialog>
|
|
#include <QLineEdit>
|
|
#include <QPushButton>
|
|
#include <QVBoxLayout>
|
|
#include <QLabel>
|
|
#include <QDebug>
|
|
|
|
class DelUserWindow : public QDialog {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit DelUserWindow(QWidget* parent = nullptr) : QDialog(parent) {
|
|
setWindowTitle("Delete User");
|
|
QVBoxLayout* layout = new QVBoxLayout(this);
|
|
QLabel* label = new QLabel("输入要删除的用户ID:", this);
|
|
layout->addWidget(label);
|
|
|
|
userInput = new QLineEdit(this);
|
|
layout->addWidget(userInput);
|
|
|
|
QPushButton* deleteButton = new QPushButton("删除用户", this);
|
|
layout->addWidget(deleteButton);
|
|
qDebug() << "------------- DelUserWindow";
|
|
connect(deleteButton, &QPushButton::clicked, this, &DelUserWindow::onDeleteButtonClicked);
|
|
}
|
|
|
|
QString getUserInput() const
|
|
{
|
|
return userInput->text();
|
|
}
|
|
|
|
signals:
|
|
void userInputEntered(const QString& userInput); // **只发送用户输入,不管取消情况**
|
|
|
|
private slots:
|
|
void onDeleteButtonClicked() {
|
|
emit userInputEntered(userInput->text()); // **发送输入值**
|
|
//close(); // **关闭窗口**
|
|
accept();
|
|
}
|
|
|
|
private:
|
|
QLineEdit* userInput;
|
|
};
|
|
|
|
#endif // DELUSERWINDOW_H
|