SL100_FactoryTestTool/FactoryTestTool/SourceCode/Network/LicenseConfirmWindow.h

53 lines
1.4 KiB
C++

#ifndef LICENSECONFIRMWINDOW_H
#define LICENSECONFIRMWINDOW_H
#include <QDialog>
#include <QPushButton>
#include <QVBoxLayout>
#include <QLabel>
class LicenseConfirmWindow : public QDialog
{
Q_OBJECT
public:
explicit LicenseConfirmWindow(const QString& message, QWidget* parent = nullptr)
{
messageLabel = new QLabel(message, this);
confirmButton = new QPushButton("确认", this);
cancelButton = new QPushButton("取消", this);
QVBoxLayout* layout = new QVBoxLayout;
layout->addWidget(messageLabel);
QHBoxLayout* buttonLayout = new QHBoxLayout;
buttonLayout->addWidget(confirmButton);
buttonLayout->addWidget(cancelButton);
layout->addLayout(buttonLayout);
setLayout(layout);
setWindowTitle("获取License");
resize(260, 100); // 设置对话框的大小
connect(confirmButton, &QPushButton::clicked, this, &LicenseConfirmWindow::onConfirmClicked);
connect(cancelButton, &QPushButton::clicked, this, &LicenseConfirmWindow::onCancelClicked);
}
private slots:
void onConfirmClicked()
{
accept();
}
void onCancelClicked()
{
reject();
}
private:
QLabel* messageLabel;
QPushButton* confirmButton;
QPushButton* cancelButton;
};
#endif // LICENSECONFIRMWINDOW_H