popMsgBox.h 719 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef POPMSGBOX_H
  2. #define POPMSGBOX_H
  3. #include <QDialog>
  4. #include <QTimer>
  5. namespace Ui {
  6. class popMsgBox;
  7. }
  8. enum class POP_MSG_BTN
  9. {
  10. pmb_yes = 1,
  11. pmb_yse_no
  12. };
  13. class popMsgBox : public QDialog
  14. {
  15. Q_OBJECT
  16. public:
  17. explicit popMsgBox(QWidget *parent = nullptr);
  18. ~popMsgBox();
  19. void setMsg(QString sMsg, QString sTitle);
  20. void initUI(POP_MSG_BTN btn);
  21. void setStayTime(int nStayTime);
  22. private slots:
  23. void on_btn_yes_clicked();
  24. void on_btn_no_clicked();
  25. private:
  26. Ui::popMsgBox *ui;
  27. std::shared_ptr<QTimer> m_timePtr;
  28. };
  29. extern int popMsg(QString sMsg, QString sTitle, QWidget *parent, POP_MSG_BTN btn = POP_MSG_BTN::pmb_yse_no, int nStayTime = 0);
  30. #endif // POPMSGBOX_H