-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcanvas.cpp
50 lines (40 loc) · 974 Bytes
/
canvas.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
#include "canvas.h"
#include "graph.h"
Canvas::Canvas(int x, int y, int w, int h, QObject *parent) :
QObject(parent)
{
graph_x = x;
graph_y = y;
graph_h = w;
graph_w = h;
}
void Canvas::drawCanvas(QPainter *painter, void *parent)
{
setCanvasBrushDefaultProperties();
setCanvasFrameLineDefaultProperties();
painter->setPen(canvasFrameLine);
painter->setBrush(canvasBrush);
if(parent)
{
Graph *p_parent = (Graph*) parent;
p_parent->setCanvasVisible();
}
painter->drawRect(graph_x, graph_y , graph_w, graph_h);
}
void Canvas::setCanvasFrameLineDefaultProperties()
{
canvasFrameLine.setColor(Qt::white);
canvasFrameLine.setWidth(1);
}
void Canvas::setCanvasBrushDefaultProperties()
{
canvasBrush.setColor(Qt::white);
canvasBrush.setStyle(Qt::SolidPattern);
}
void Canvas::setGeometry(int x, int y, int w, int h)
{
graph_x = x;
graph_y = y;
graph_w = w;
graph_h = h;
}