-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscreenshotarea.cpp
53 lines (42 loc) · 1.1 KB
/
screenshotarea.cpp
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
#include "screenshotarea.h"
#include "ui_screenshotarea.h"
ScreenshotArea::ScreenshotArea(QWidget *parent) :
QWidget(parent),
ui(new Ui::ScreenshotArea)
{
ui->setupUi(this);
//this->setGeometry(QRect (50,50, 300, 300));
//this->setStyleSheet("background-color: #F5EEA7;");
//this->setWindowOpacity(0.5);
//this->setWindowTitle(tr("Îáëàñòü ýêðàíà"));
//this->setWindowState(Qt::WindowNoState);
//this->setWindowFlags(Qt::FramelessWindowHint);
//this->show();
}
ScreenshotArea::~ScreenshotArea()
{
delete ui;
}
void ScreenshotArea::hideEvent(QHideEvent *event )
{
emit screenshotareahidden(QRect(this->x(),this->y(),this->width(),this->height()));
}
void ScreenshotArea::changeEvent(QEvent *e)
{
bIsDown = false;
}
void ScreenshotArea::mousePressEvent(QMouseEvent *e)
{
bIsDown = true;
x1 = e->x();
y1 = e->y();
}
void ScreenshotArea::mouseMoveEvent(QMouseEvent *e)
{
if(bIsDown)
this->move(QPoint(this->pos().x() + e->x() - x1, this->pos().y() + e->y() - y1));
}
void ScreenshotArea::mouseDoubleClickEvent(QMouseEvent *e)
{
this->hide();
}