JMessageDlg.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef JMESSAGEDLG_H
  2. #define JMESSAGEDLG_H
  3. #include <QDialog>
  4. #include <QMessageBox>
  5. //消息类型
  6. enum MSG_TYPE
  7. {
  8. question,
  9. };
  10. namespace Ui {
  11. class JMessageDlg;
  12. }
  13. class JMessageDlg : public QDialog
  14. {
  15. Q_OBJECT
  16. public:
  17. explicit JMessageDlg(QWidget *parent = nullptr);
  18. ~JMessageDlg();
  19. /**设置提示
  20. * @strTitle 标题
  21. * @strTip 提示文字
  22. */
  23. void SetTip(const QString& title,const QString& text, MSG_TYPE type = MSG_TYPE::question);
  24. protected:
  25. void paintEvent(QPaintEvent *event) override;
  26. void mousePressEvent(QMouseEvent *event) override;
  27. void mouseMoveEvent(QMouseEvent *event) override;
  28. void mouseReleaseEvent(QMouseEvent *event) override;
  29. private slots:
  30. void on_closeBut_clicked();
  31. void on_yesBut_clicked();
  32. void on_noBut_clicked();
  33. private:
  34. QPoint m_dragPosition;
  35. bool m_dragging;
  36. int m_cornerRadius;
  37. QColor m_backgroundColor;
  38. private:
  39. Ui::JMessageDlg *ui;
  40. public:
  41. /**返回值
  42. */
  43. QMessageBox::StandardButton m_ret = QMessageBox::NoButton;
  44. };
  45. #endif // JMESSAGEDLG_H