#ifndef CUSTOMMESSAGEBOX_H #define CUSTOMMESSAGEBOX_H #include #include class CustomMessageBox : public QMessageBox { Q_OBJECT public: explicit CustomMessageBox(QWidget *parent = nullptr); // 显示确认对话框,返回用户选择的结果 static bool showConfirmDialog(const QString &title, const QString &text, const QString &yesButtonText = "确定", const QString &noButtonText = "取消", QWidget *parent = nullptr); // 显示超时等待确认对话框 static bool showTimeoutDialog(const QString &title, const QString &text, const QString &continueButtonText = "继续等待", const QString &cancelButtonText = "强制取消", QWidget *parent = nullptr); private: void setupButtonStyles(QPushButton *yesButton, QPushButton *noButton); }; #endif // CUSTOMMESSAGEBOX_H