95void QArrow::paint(QPainter* painter,
const QStyleOptionGraphicsItem* option,
103 double theta = atan(ddeltaY / ddeltaX);
104 double theta2 = (ddeltaX < 0.0) ? (theta +
PI) : theta;
105 int lengthdeltaX = -
static_cast<int>(cos(theta2) *
_headLength);
106 int lengthdeltaY = -
static_cast<int>(sin(theta2) *
_headLength);
107 auto widthdeltaX =
static_cast<int>(sin(theta2) *
_headWidth);
108 auto widthdeltaY =
static_cast<int>(cos(theta2) *
_headWidth);
109 auto deltaX =
static_cast<int>(ddeltaX);
110 auto deltaY =
static_cast<int>(ddeltaY);
112 painter->drawLine(0, 0, deltaX, deltaY);
113 painter->drawLine(deltaX,
115 deltaX + lengthdeltaX + widthdeltaX,
116 deltaY + lengthdeltaY - widthdeltaY);
117 painter->drawLine(deltaX,
119 deltaX + lengthdeltaX - widthdeltaX,
120 deltaY + lengthdeltaY + widthdeltaY);
QArrow(qreal l, qreal a, qreal hl, qreal hw, QPen &pen, QGraphicsItem *parent=nullptr)