1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #ifndef WARNING_H
- #define WARNING_H
- #include <QDialog>
- class OneShadow;
- namespace Ui {
- class Warning;
- }
- class Warning : public QDialog
- {
- Q_OBJECT
- public:
- explicit Warning(QWidget *parent = nullptr);
- ~Warning();
- void setText(const QString& text);
- void setTextWithOneButton(const QString& text); /* 只有一个确定按钮 */
- bool isOk() const { return m_isOk; }
- signals:
- void signal_ok();
- protected:
- void paintEvent(QPaintEvent *event) override;
- /* 鼠标点击事件 */
- void mousePressEvent(QMouseEvent *event) override;
- /* 鼠标移动事件 */
- void mouseMoveEvent(QMouseEvent *event) override;
- /* 鼠标释放事件 */
- void mouseReleaseEvent(QMouseEvent *event) override;
- private slots:
- void do_ok();
- private:
- Ui::Warning *ui;
- OneShadow* m_shadow = nullptr;
- const int SHADOW_W = 16; /* 阴影的大小 */
- bool m_isOk = false;
- QPoint m_lastPos;
- };
- #endif // WARNING_H
|