#ifndef CONFIRMDIALOG_H #define CONFIRMDIALOG_H #include class QLabel; // ===================== 确认弹窗 ===================== // 标题 + 正文 + 确认/取消;另提供 2s 自动消失的轻提示(toast) class ConfirmDialog : public QDialog { Q_OBJECT public: explicit ConfirmDialog(QWidget* parent = nullptr); void setTitle(const QString& t); void setText(const QString& t); // 模态确认,返回是否“确认” static bool confirm(QWidget* parent, const QString& title, const QString& text); // 轻提示:显示 text,ms 毫秒后自动消失(用于“修改成功”等) static void toast(QWidget* parent, const QString& text, int ms = 2000); private: QLabel* m_title = nullptr; QLabel* m_body = nullptr; }; #endif // CONFIRMDIALOG_H