2025-07-23 01:35:14 +08:00
|
|
|
#ifndef STYLEDMESSAGEBOX_H
|
|
|
|
|
#define STYLEDMESSAGEBOX_H
|
|
|
|
|
|
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
|
|
class StyledMessageBox
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
// 静态方法,显示信息弹窗
|
|
|
|
|
static void information(QWidget* parent, const QString& title, const QString& text);
|
|
|
|
|
|
|
|
|
|
// 静态方法,显示警告弹窗
|
|
|
|
|
static void warning(QWidget* parent, const QString& title, const QString& text);
|
|
|
|
|
|
|
|
|
|
// 静态方法,显示错误弹窗
|
|
|
|
|
static void critical(QWidget* parent, const QString& title, const QString& text);
|
2025-09-06 15:07:16 +08:00
|
|
|
|
|
|
|
|
// 静态方法,显示带有自定义按钮的弹窗
|
|
|
|
|
static QMessageBox::StandardButton question(QWidget* parent, const QString& title, const QString& text, QMessageBox::StandardButtons buttons = QMessageBox::Ok);
|
2025-07-23 01:35:14 +08:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
// 私有方法,应用统一的样式
|
|
|
|
|
static void applyStyle(QMessageBox& msgBox);
|
|
|
|
|
|
|
|
|
|
// 私有方法,设置中文按钮文本
|
|
|
|
|
static void setChineseButtonText(QMessageBox& msgBox);
|
|
|
|
|
};
|
|
|
|
|
|
2025-09-06 15:07:16 +08:00
|
|
|
#endif // STYLEDMESSAGEBOX_H
|