warning.h 699 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef WARNING_H
  2. #define WARNING_H
  3. #include <QDialog>
  4. class OneShadow;
  5. namespace Ui {
  6. class Warning;
  7. }
  8. class Warning : public QDialog
  9. {
  10. Q_OBJECT
  11. public:
  12. explicit Warning(QWidget *parent = nullptr);
  13. ~Warning();
  14. void setText(const QString& text);
  15. void setTextWithOneButton(const QString& text); /* 只有一个确定按钮 */
  16. bool isOk() const { return m_isOk; }
  17. signals:
  18. void signal_ok();
  19. protected:
  20. void paintEvent(QPaintEvent *event);
  21. private slots:
  22. void do_ok();
  23. private:
  24. Ui::Warning *ui;
  25. OneShadow* m_shadow = nullptr;
  26. const int SHADOW_W = 16; /* 阴影的大小 */
  27. bool m_isOk = false;
  28. };
  29. #endif // WARNING_H