#ifndef JMESSAGEDLG_H #define JMESSAGEDLG_H #include #include //消息类型 enum MSG_TYPE { question, }; namespace Ui { class JMessageDlg; } class JMessageDlg : public QDialog { Q_OBJECT public: explicit JMessageDlg(QWidget *parent = nullptr); ~JMessageDlg(); /**设置提示 * @strTitle 标题 * @strTip 提示文字 */ void SetTip(const QString& title,const QString& text, MSG_TYPE type = MSG_TYPE::question); protected: void paintEvent(QPaintEvent *event) override; void mousePressEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override; private slots: void on_closeBut_clicked(); void on_yesBut_clicked(); void on_noBut_clicked(); private: QPoint m_dragPosition; bool m_dragging; int m_cornerRadius; QColor m_backgroundColor; private: Ui::JMessageDlg *ui; public: /**返回值 */ QMessageBox::StandardButton m_ret = QMessageBox::NoButton; }; #endif // JMESSAGEDLG_H