-
Notifications
You must be signed in to change notification settings - Fork 1
/
titlebar.h
52 lines (42 loc) · 1.1 KB
/
titlebar.h
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
#ifndef TITLEBAR_H
#define TITLEBAR_H
#include <QWidget>
#include <QPushButton>
#include <QTextEdit>
#include <QPoint>
#include <QMouseEvent>
#include <QHBoxLayout>
#define BTN_WIDTH 24
#define TITLEBAR_HEIGHT 28
class TitleBar : public QWidget{
Q_OBJECT
public:
explicit TitleBar(QWidget *parent = nullptr);
~TitleBar();
void setBtnsVisible(bool);
signals:
void newBtnClickedSignal();
void settingBtnClickedSignal();
void deleteBtnClickedSignal();
void closeBtnClickedSignal();
private slots:
void onNewBtnClicked();
void onSettingBtnClicked();
void onDeleteBtnClicked();
void onCloseBtnClicked();
private:
QPushButton *new_btn;
QPushButton *setting_btn;
QPushButton *delete_btn;
QPushButton *close_btn;
QHBoxLayout *titlebar_layout;
bool m_bPressed;
QPoint m_point;
void initControl();
void initConnection();
protected:
virtual void mouseMoveEvent(QMouseEvent *event) override;
virtual void mousePressEvent(QMouseEvent *event) override;
virtual void mouseReleaseEvent(QMouseEvent *event) override;
};
#endif // TITLEBAR_H