awMsgBox.h 813 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef AWMSGBOX_H
  2. #define AWMSGBOX_H
  3. #include <QDialog>
  4. #include <mutex>
  5. namespace Ui {
  6. class awMsgBox;
  7. }
  8. #include <QTimer>
  9. enum class MSG_ICON_TYPE
  10. {
  11. mit_information = 1,
  12. mit_succeed,
  13. mit_error
  14. };
  15. class awMsgBox : public QDialog
  16. {
  17. Q_OBJECT
  18. public:
  19. explicit awMsgBox(QWidget *parent = nullptr);
  20. ~awMsgBox();
  21. void initUI(MSG_ICON_TYPE type);
  22. void setMsg(QString sMsg);
  23. static void clear(QWidget *parent = nullptr);
  24. static std::list< std::shared_ptr<awMsgBox>> vMsgList;
  25. static std::mutex msgMutex;
  26. private slots:
  27. void on_btn_awmb_close_clicked();
  28. private:
  29. Ui::awMsgBox *ui;
  30. std::shared_ptr<QTimer> m_pTimer;
  31. };
  32. extern void ShowMsg(QString sMsg, QWidget *parent = nullptr, MSG_ICON_TYPE type = MSG_ICON_TYPE::mit_information);
  33. #endif // AWMSGBOX_H