warning.h 886 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. /* 重新设置显示文字的区域大小 */
  25. void resetLabelSize();
  26. /* 移动警告图标 */
  27. void moveWarnICON();
  28. private:
  29. Ui::Warning *ui;
  30. OneShadow* m_shadow = nullptr;
  31. const int SHADOW_W = 16; /* 阴影的大小 */
  32. bool m_isOk = false;
  33. };
  34. #endif // WARNING_H