whyclwt
2022-05-18 ab72c6e114d7c4e83564194367ba623ca23bf09d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef MESSAGEBOX_H
#define MESSAGEBOX_H
 
#include <QDialog>
#include <QtGui/QMouseEvent>
#include <QLabel>
#include "WorkThread/work_thread.h"
#include "CustomClass/custom_dialog.h"
 
namespace Ui {
class MessageBox;
}
 
class MessageBox : public QDialog
{
    Q_OBJECT
    
public:
    enum ButtonEnum {
        NoButton         = 0x00,
        Yes              = 0x01,
        Ok               = 0x02,
        No               = 0x04
    };
    Q_DECLARE_FLAGS(myButtons, ButtonEnum)
 
    MessageBox(QWidget *parent,const QString &text,myButtons buttons, Work_Thread *thread = 0);
    ~MessageBox();
    void settext(const QString text);
    void set_yes_btn_text(bool en, QString str);
 
private:
    Ui::MessageBox *ui;
    bool        mMoveing;
    QPoint        mMovePosition;
 
    Work_Thread *workThread;
    QTimer *t_timer;
 
    virtual void mousePressEvent(QMouseEvent *event);
    virtual void mouseMoveEvent(QMouseEvent *event);
    virtual void mouseReleaseEvent(QMouseEvent *event);
 
    void initpage();
    void setButtons(myButtons buttons);
    void setLabelWidth(QLabel *Label, const QString &text);
private slots:
    void btn_beep(void);
    void onButtonReleased(void);
 
    void checkAutoClose(void);
};
Q_DECLARE_OPERATORS_FOR_FLAGS(MessageBox::myButtons)
 
#endif // MESSAGEBOX_H