From f07ea90fe5313bb85c96fbf455a5093af955789b Mon Sep 17 00:00:00 2001
From: Oscar Gustafsson <oscar.gustafsson@gmail.com>
Date: Tue, 24 Jan 2023 10:59:47 +0100
Subject: [PATCH] Replace line with polygon in arrow

---
 b_asic/GUI/arrow.py | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/b_asic/GUI/arrow.py b/b_asic/GUI/arrow.py
index 98c7466b..66805a43 100644
--- a/b_asic/GUI/arrow.py
+++ b/b_asic/GUI/arrow.py
@@ -1,12 +1,12 @@
-from qtpy.QtCore import QLineF, Qt
-from qtpy.QtGui import QPen
-from qtpy.QtWidgets import QGraphicsLineItem, QMenu
+from qtpy.QtCore import QPointF
+from qtpy.QtGui import QPen, QPolygonF
+from qtpy.QtWidgets import QGraphicsPolygonItem, QMenu
 
-from b_asic.GUI._preferences import LINECOLOR
+from b_asic.GUI._preferences import LINECOLOR, PORTHEIGHT, PORTWIDTH
 from b_asic.signal import Signal
 
 
-class Arrow(QGraphicsLineItem):
+class Arrow(QGraphicsPolygonItem):
     """Arrow/connection in signal flow graph GUI."""
 
     def __init__(self, source, destination, window, signal=None, parent=None):
@@ -81,11 +81,9 @@ class Arrow(QGraphicsLineItem):
         Draw a line connecting self.source with self.destination. Used as callback when moving operations.
         """
         self.setPen(QPen(LINECOLOR, 3))
-        self.setLine(
-            QLineF(
-                self.source.operation.x() + self.source.x() + 14,
-                self.source.operation.y() + self.source.y() + 7.5,
-                self.destination.operation.x() + self.destination.x(),
-                self.destination.operation.y() + self.destination.y() + 7.5,
-            )
-        )
+        x0 = self.source.operation.x() + self.source.x() + PORTWIDTH
+        y0 = self.source.operation.y() + self.source.y() + PORTHEIGHT/2
+        x1 = self.destination.operation.x() + self.destination.x()
+        y1 = self.destination.operation.y() + self.destination.y() + PORTHEIGHT/2
+        p = QPolygonF() << QPointF(x0, y0) << QPointF(x1, y1)
+        self.setPolygon(p)
-- 
GitLab