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

network: Reduce size of edge and fill the polygon.

Showing with 10 additions and 2 deletions
+10 -2
......@@ -141,7 +141,7 @@ class EdgeItem(QGraphicsItem):
elif not self.graph.graph.is_enable_edge(self.edge):
color = Qt.darkGray
painter.setPen(QPen(color, 3, Qt.SolidLine, Qt.RoundCap,
painter.setPen(QPen(color, 2, Qt.SolidLine, Qt.RoundCap,
Qt.RoundJoin))
# Draw the line
painter.drawLine(line)
......@@ -152,6 +152,10 @@ class EdgeItem(QGraphicsItem):
)
# Draw the arrows
brush = QBrush()
brush.setColor(color)
brush.setStyle(Qt.SolidPattern)
angle = math.acos(line.dx() / line.length())
if line.dy() >= 0:
angle = (math.pi * 2.0) - angle
......@@ -165,8 +169,12 @@ class EdgeItem(QGraphicsItem):
math.sin(angle - math.pi + math.pi / 3) * size,
math.cos(angle - math.pi + math.pi / 3) * size
)
poly = QPolygonF([line_center, arrow_p1, arrow_p2])
path = QPainterPath()
path.addPolygon(poly)
painter.drawPolygon(QPolygonF([line_center, arrow_p1, arrow_p2]))
painter.drawPolygon(poly)
painter.fillPath(path, brush)
class NodeText(QGraphicsTextItem):
def __init__(self, node_item):
......
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