popMsgBox.h 888 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 setBtnText(QString sBtnYesText, QString sBtnNoText);
  20. void setMsg(QString sMsg, QString sTitle);
  21. void initUI(POP_MSG_BTN btn);
  22. void setStayTime(int nStayTime);
  23. private slots:
  24. void on_btn_yes_clicked();
  25. void on_btn_no_clicked();
  26. private:
  27. Ui::popMsgBox *ui;
  28. std::shared_ptr<QTimer> m_timePtr;
  29. };
  30. extern int popMsg(QString sMsg, QString sTitle, QWidget *parent, QString sBtnYesText, QString sBtnNoText);
  31. extern int popMsg(QString sMsg, QString sTitle, QWidget *parent, POP_MSG_BTN btn = POP_MSG_BTN::pmb_yse_no, int nStayTime = 0);
  32. #endif // POPMSGBOX_H