-
Notifications
You must be signed in to change notification settings - Fork 948
Expand file tree
/
Copy pathConnectionGraphicsObject.hpp
More file actions
90 lines (61 loc) · 1.4 KB
/
ConnectionGraphicsObject.hpp
File metadata and controls
90 lines (61 loc) · 1.4 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
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
89
90
#pragma once
#include <QtCore/QUuid>
#include <QtWidgets/QGraphicsObject>
#include "Export.hpp"
class QGraphicsSceneMouseEvent;
namespace QtNodes
{
class FlowScene;
class Connection;
class ConnectionGeometry;
class Node;
/// Graphic Object for connection. Adds itself to scene
class NODE_EDITOR_PUBLIC ConnectionGraphicsObject
: public QGraphicsObject
{
Q_OBJECT
public:
ConnectionGraphicsObject(FlowScene &scene,
Connection &connection);
virtual
~ConnectionGraphicsObject();
enum { Type = UserType + 2 };
int
type() const override { return Type; }
public:
Connection&
connection();
QRectF
boundingRect() const override;
QPainterPath
shape() const override;
void
setGeometryChanged();
/// Updates the position of both ends
void
move();
void
lock(bool locked);
protected:
void
paint(QPainter* painter,
QStyleOptionGraphicsItem const* option,
QWidget* widget = 0) override;
void
mousePressEvent(QGraphicsSceneMouseEvent* event) override;
void
mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
void
mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
void
hoverEnterEvent(QGraphicsSceneHoverEvent* event) override;
void
hoverLeaveEvent(QGraphicsSceneHoverEvent* event) override;
private:
void
addGraphicsEffect();
private:
FlowScene & _scene;
Connection& _connection;
};
}