| 129 | } |
| 130 | |
| 131 | static |
| 132 | void |
| 133 | drawHoveredOrSelected(QPainter * painter, |
| 134 | Connection const & connection) |
| 135 | { |
| 136 | using QtNodes::ConnectionGeometry; |
| 137 | |
| 138 | ConnectionGeometry const& geom = connection.connectionGeometry(); |
| 139 | bool const hovered = geom.hovered(); |
| 140 | |
| 141 | auto const& graphicsObject = |
| 142 | connection.connectionGraphicsObject(); |
| 143 | |
| 144 | bool const selected = graphicsObject.isSelected(); |
| 145 | |
| 146 | // drawn as a fat background |
| 147 | if (hovered || selected) |
| 148 | { |
| 149 | QPen p; |
| 150 | |
| 151 | auto const & connectionStyle = connection.style(); |
| 152 | double const lineWidth = connectionStyle.lineWidth(); |
| 153 | |
| 154 | p.setWidth(1.6 * lineWidth); |
| 155 | p.setColor(selected ? |
| 156 | connectionStyle.selectedHaloColor() : |
| 157 | connectionStyle.hoveredColor()); |
| 158 | |
| 159 | painter->setPen(p); |
| 160 | painter->setBrush(Qt::NoBrush); |
| 161 | |
| 162 | // cubic spline |
| 163 | auto cubic = cubicPath(geom); |
| 164 | painter->drawPath(cubic); |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | |
| 169 | static |