Commit cec8eac4 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

network: Fix edge bounding rect.

Showing with 9 additions and 7 deletions
+9 -7
......@@ -132,9 +132,6 @@ class EdgeItem(QGraphicsItem):
self.graph = graph_widget
self.src_pos = src_node_item.pos()
self.dest_pos = dest_node_item.pos()
self.setAcceptedMouseButtons(Qt.NoButton)
self.adjust()
......@@ -169,15 +166,20 @@ class EdgeItem(QGraphicsItem):
extra = (pen_width + 5) / 2.0
return QRectF(
self.src_pos,
self.src_node.pos(),
QSizeF(
self.dest_pos.x() - self.src_pos.x(),
self.dest_pos.y() - self.src_pos.y()
self.dest_node.pos().x() - self.src_node.pos().x(),
self.dest_node.pos().y() - self.src_node.pos().y()
)
).normalized().adjusted(-extra, -extra, extra, extra)
def paint(self, painter, option, widget):
# Draw the line itself.
color = QColor(Qt.white)
color.setAlpha(128)
painter.setBrush(color)
painter.drawRect(self.boundingRect())
line = QLineF(self.src_node.pos(), self.dest_node.pos())
if line.length() == 0.0:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment