Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
158 lines (113 loc) · 3.06 KB

File metadata and controls

158 lines (113 loc) · 3.06 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#pragma once
#include <memory>
#include <QtCore/QRectF>
#include <QtCore/QPointF>
#include <QtGui/QTransform>
#include <QtGui/QFontMetrics>
#include "PortType.hpp"
namespace QtNodes
{
class NodeState;
class NodeDataModel;
class Node;
class NodeGeometry
{
public:
NodeGeometry(std::unique_ptr<NodeDataModel> const &dataModel);
public:
unsigned int
height() const { return _height; }
void
setHeight(unsigned int h) { _height = h; }
unsigned int
width() const { return _width; }
void
setWidth(unsigned int w) { _width = w; }
unsigned int
entryHeight() const { return _entryHeight; }
void
setEntryHeight(unsigned int h) { _entryHeight = h; }
unsigned int
entryWidth() const { return _entryWidth; }
void
setEntryWidth(unsigned int w) { _entryWidth = w; }
unsigned int
spacing() const { return _spacing; }
void
setSpacing(unsigned int s) { _spacing = s; }
bool
hovered() const { return _hovered; }
void
setHovered(unsigned int h) { _hovered = h; }
unsigned int
nSources() const { return _nSources; }
unsigned int
nSinks() const { return _nSinks; }
QPointF const&
draggingPos() const
{ return _draggingPos; }
void
setDraggingPosition(QPointF const& pos)
{ _draggingPos = pos; }
public:
QRectF
entryBoundingRect() const;
QRectF
boundingRect() const;
/// Updates size unconditionally
void
recalculateSize() const;
/// Updates size if the QFontMetrics is changed
void
recalculateSize(QFont const &font) const;
// TODO removed default QTransform()
QPointF
portScenePosition(PortIndex index,
PortType portType,
QTransform t = QTransform()) const;
PortIndex
checkHitScenePoint(PortType portType,
QPointF const point,
QTransform t = QTransform()) const;
QRect
resizeRect() const;
/// Returns the position of a widget on the Node surface
QPointF
widgetPosition() const;
unsigned int
validationHeight() const;
unsigned int
validationWidth() const;
static
QPointF
calculateNodePositionBetweenNodePorts(PortIndex targetPortIndex, PortType targetPort, Node* targetNode,
PortIndex sourcePortIndex, PortType sourcePort, Node* sourceNode,
Node& newNode);
private:
unsigned int
captionHeight() const;
unsigned int
captionWidth() const;
unsigned int
portWidth(PortType portType) const;
private:
// some variables are mutable because
// we need to change drawing metrics
// corresponding to fontMetrics
// but this doesn't change constness of Node
mutable unsigned int _width;
mutable unsigned int _height;
unsigned int _entryWidth;
mutable unsigned int _inputPortWidth;
mutable unsigned int _outputPortWidth;
mutable unsigned int _entryHeight;
unsigned int _spacing;
bool _hovered;
unsigned int _nSources;
unsigned int _nSinks;
QPointF _draggingPos;
std::unique_ptr<NodeDataModel> const &_dataModel;
mutable QFontMetrics _fontMetrics;
mutable QFontMetrics _boldFontMetrics;
};
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.