| 167 | |
| 168 | |
| 169 | static |
| 170 | void |
| 171 | drawNormalLine(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; |
no test coverage detected