-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathctoplabel.h
88 lines (60 loc) · 1.45 KB
/
ctoplabel.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef CTOPLABEL_H
#define CTOPLABEL_H
#include <QtWidgets>
#include <QCursor>
#include "controlbar.h"
class CTopLabel : public QLabel
{
Q_OBJECT
public:
explicit CTopLabel(QWidget *parent = 0);
//截图状态
enum shotState{initShot,beginShot,finishShot};
void setLabelId(WId id){labelId=id;}
~CTopLabel();
signals:
//发送关闭信号
void meClosed(WId);
//完成截屏信号
void shotted();
private slots:
//逆时针旋转
void turnLeft();
//顺时针旋转
void turnRight();
//保存图像
void savePic();
private:
ControlBar* controlBar;
//调整控制条的位置
void setContralBarPos();
int labelId;
//全屏Pixmap
QPixmap fullScreenPixmap;
//截图pixmap
QPixmap resultPixmap;
//截图状态
shotState currentState;
//鼠标起始点
QPoint beginPoint;
//终点
QPoint endPoint;
//鼠标拖动矩形
QRect shotRect;
//是否正在截图
bool isShot;
//左键是否按下
bool isPressed;
//拖动点
QPoint dragPosition;
// 指针当前位置的颜色
QColor pointColor;
void paintEvent(QPaintEvent *);
void mousePressEvent(QMouseEvent *ev);
void mouseMoveEvent(QMouseEvent *ev);
void mouseReleaseEvent(QMouseEvent *ev);
void mouseDoubleClickEvent(QMouseEvent *);
void keyPressEvent(QKeyEvent *ev);
void leaveEvent(QEvent *event);
};
#endif // CTOPLABEL_H