mirror of https://gitlab.com/pamhyr/pamhyr2
network: Fix edge bounding rect.
parent
0d3f6672fd
commit
cec8eac432
|
|
@ -132,9 +132,6 @@ class EdgeItem(QGraphicsItem):
|
||||||
|
|
||||||
self.graph = graph_widget
|
self.graph = graph_widget
|
||||||
|
|
||||||
self.src_pos = src_node_item.pos()
|
|
||||||
self.dest_pos = dest_node_item.pos()
|
|
||||||
|
|
||||||
self.setAcceptedMouseButtons(Qt.NoButton)
|
self.setAcceptedMouseButtons(Qt.NoButton)
|
||||||
self.adjust()
|
self.adjust()
|
||||||
|
|
||||||
|
|
@ -169,15 +166,20 @@ class EdgeItem(QGraphicsItem):
|
||||||
extra = (pen_width + 5) / 2.0
|
extra = (pen_width + 5) / 2.0
|
||||||
|
|
||||||
return QRectF(
|
return QRectF(
|
||||||
self.src_pos,
|
self.src_node.pos(),
|
||||||
QSizeF(
|
QSizeF(
|
||||||
self.dest_pos.x() - self.src_pos.x(),
|
self.dest_node.pos().x() - self.src_node.pos().x(),
|
||||||
self.dest_pos.y() - self.src_pos.y()
|
self.dest_node.pos().y() - self.src_node.pos().y()
|
||||||
)
|
)
|
||||||
).normalized().adjusted(-extra, -extra, extra, extra)
|
).normalized().adjusted(-extra, -extra, extra, extra)
|
||||||
|
|
||||||
def paint(self, painter, option, widget):
|
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())
|
line = QLineF(self.src_node.pos(), self.dest_node.pos())
|
||||||
|
|
||||||
if line.length() == 0.0:
|
if line.length() == 0.0:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue