-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathConnectionLine.cpp
More file actions
55 lines (32 loc) · 955 Bytes
/
ConnectionLine.cpp
File metadata and controls
55 lines (32 loc) · 955 Bytes
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 "ConnectionLine.hpp"
ConnectionLine::ConnectionLine(SceneNode* cvor1, SceneNode* cvor2)
: pocetniCvor(cvor1), krajnjiCvor(cvor2)
{
}
SceneNode *ConnectionLine::getPocetniCvor()
{
return pocetniCvor;
}
SceneNode *ConnectionLine::getKrajnjiCvor()
{
return krajnjiCvor;
};
QRectF ConnectionLine::boundingRect() const
{
return QRectF(0,0,1,1);
}
void ConnectionLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(option)
//fja iscrtava liniju od pocetnog ka krajnjem cvoru
QPen olovka(Qt::black);
if(isSelected())
olovka.setColor(Qt::yellow);
olovka.setWidth(6);
painter->setPen(olovka);
QPointF pocetak(pocetniCvor->x()+35, pocetniCvor->y()+35);
QPointF kraj(krajnjiCvor->x()+35, krajnjiCvor->y()+35);
painter->drawLine(pocetak,kraj);
painter->drawEllipse(kraj, 5, 5);
painter->drawEllipse(pocetak, 5, 5);
}