-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreceivewindow.cpp
More file actions
65 lines (50 loc) · 1.14 KB
/
receivewindow.cpp
File metadata and controls
65 lines (50 loc) · 1.14 KB
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
#include "receivewindow.h"
ReceiveWindow::ReceiveWindow(QWidget *parent) : QWidget(parent)
{
image = QImage(600,400,QImage::Format_RGB32);
image.fill(qRgb(255,255,255));
rThread.start();
connect(&rThread, SIGNAL(readingFinished()), this, SLOT(receiveData()));
connect(&rThread, SIGNAL(clearBtnSignal()),this, SLOT(clearScreen()));
}
void ReceiveWindow::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
rect = event->rect();
painter.drawImage(rect, image, rect);
}
void ReceiveWindow::drawLineTo()
{
QPainter painter(&image);
painter.drawLine(startPoint, endPoint);
update();
}
void ReceiveWindow::receiveData()
{
startPoint.setX(rThread.getSX());
startPoint.setY(rThread.getSY());
endPoint.setX(rThread.getEX());
endPoint.setY(rThread.getEY());
drawLineTo();
}
void ReceiveWindow::clearScreen()
{
image.fill(qRgb(255,255,255));
update();
}
void ReceiveWindow::setSX(int c)
{
sCoordinateX=c;
}
void ReceiveWindow::setSY(int c)
{
sCoordinateY=c;
}
void ReceiveWindow::setEX(int c)
{
eCoordinateX=c;
}
void ReceiveWindow::setEY(int c)
{
eCoordinateX=c;
}