20 #include "../../cpp_simptshell/mesh_drawer/ArrowItem.h"
30 void ArrowItem::paint(QPainter* p,
const QStyleOptionGraphicsItem* ,
QWidget* )
33 QPointF
const start = line().p1();
34 QPointF
const end = line().p2();
35 QPointF
const mid = start + 0.75e0 * (end - start);
36 double const vx = end.x() - start.x();
37 double const vy = end.y() - start.y();
39 double length = sqrt(vx * vx + vy * vy);
42 double const px = -vy / length;
43 double const py = vx / length;
47 QPointF
const arwp1 = mid + QPointF((
int) ((length / 4.) * px), (
int) ((length / 4.) * py));
48 QPointF
const arwp2 = mid - QPointF((
int) ((length / 4.) * px), (
int) ((length / 4.) * py));
52 p->drawLine(end, arwp1);
53 p->drawLine(end, arwp2);
55 p->drawLine(start, end);
Namespace for SimPT shell package.
see the online Qt documentation
see the online Qt documentation
see the online Qt documentation