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

Function drawNormalLine

QtNodeEditor/src/ConnectionPainter.cpp:169–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167
168
169static
170void
171drawNormalLine(QPainter * painter,
172 Connection const & connection)
173{
174 using QtNodes::ConnectionState;
175
176 ConnectionState const& state =
177 connection.connectionState();
178
179 if (state.requiresPort())
180 return;
181
182 // colors
183
184 auto const & connectionStyle = connection.style();
185
186 QColor normalColorOut = connectionStyle.normalColor();
187 QColor normalColorIn = connectionStyle.normalColor();
188 QColor selectedColor = connectionStyle.selectedColor();
189
190 bool gradientColor = false;
191
192 if (connectionStyle.useDataDefinedColors())
193 {
194 using QtNodes::PortType;
195
196 auto dataTypeOut = connection.dataType(PortType::Out);
197 auto dataTypeIn = connection.dataType(PortType::In);
198
199 gradientColor = (dataTypeOut.id != dataTypeIn.id);
200
201 normalColorOut = connectionStyle.normalColor(dataTypeOut.id);
202 normalColorIn = connectionStyle.normalColor(dataTypeIn.id);
203 selectedColor = normalColorOut.darker(200);
204 }
205
206 // geometry
207
208 ConnectionGeometry const& geom = connection.connectionGeometry();
209
210 double const lineWidth = connectionStyle.lineWidth();
211
212 // draw normal line
213 QPen p;
214
215 p.setWidth(lineWidth);
216
217 auto const& graphicsObject = connection.connectionGraphicsObject();
218 bool const selected = graphicsObject.isSelected();
219
220
221 auto cubic = cubicPath(geom);
222 if (gradientColor)
223 {
224 painter->setBrush(Qt::NoBrush);
225
226 QColor c = normalColorOut;

Callers 1

paintMethod · 0.85

Calls 4

cubicPathFunction · 0.85
requiresPortMethod · 0.80
dataTypeMethod · 0.80
lineWidthMethod · 0.80

Tested by

no test coverage detected