MCPcopy Create free account
hub / github.com/BehaviorTree/Groot / portScenePosition

Method portScenePosition

QtNodeEditor/src/NodeGeometry.cpp:138–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136
137
138QPointF
139NodeGeometry::
140portScenePosition(PortIndex index,
141 PortType portType,
142 QTransform const & t) const
143{
144 auto const connectionDiameter = StyleCollection::nodeStyle().ConnectionPointDiameter;
145
146 if( _ports_layout == PortLayout::Horizontal)
147 {
148 unsigned int step = _entryHeight + _spacing;
149 double totalHeight = step * index;
150 totalHeight += step / 2.0;
151
152 double x = (portType == PortType::Out) ? _width + connectionDiameter :
153 - connectionDiameter;
154 return t.map( QPointF(x, totalHeight) );
155 }
156 else
157 {
158 unsigned int nPorts = _dataModel->nPorts(portType);
159 unsigned int step = _width / (nPorts + 1);
160 double x = step * (index+1);
161
162 double y = (portType == PortType::Out) ? _height + connectionDiameter :
163 - connectionDiameter;
164 return t.map( QPointF( x, y) );
165 }
166}
167
168
169PortIndex

Callers

nothing calls this directly

Calls 2

QPointFClass · 0.50
nPortsMethod · 0.45

Tested by

no test coverage detected