56 #include <QtCore/qmath.h>
61 : QGraphicsLineItem(parent),
67 : QGraphicsLineItem(line, parent),
72 void VScaledLine::paint(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget)
78 QGraphicsLineItem::paint(painter, option, widget);
95 : QGraphicsLineItem(parent)
101 : QGraphicsLineItem(line, parent)
114 path.moveTo(line().p1());
115 path.lineTo(line().p2());
117 qreal arrow_step = 60;
118 qreal arrow_size = 10;
120 if (line().length() < arrow_step)
126 axis.setP1(line().p1());
127 axis.setAngle(line().angle());
128 axis.setLength(arrow_step);
130 int steps = qFloor(line().length()/arrow_step);
131 for (
int i=0; i<steps; ++i)
134 axis.setLength(axis.length()+arrow_step);
138 QGraphicsLineItem::paint(painter, option, widget);
145 arrowPart1.setP1(axis.p2());
146 arrowPart1.setLength(arrow_size);
147 arrowPart1.setAngle(axis.angle()+180+35);
149 path.moveTo(arrowPart1.p1());
150 path.lineTo(arrowPart1.p2());
153 arrowPart2.setP1(axis.p2());
154 arrowPart2.setLength(arrow_size);
155 arrowPart2.setAngle(axis.angle()+180-35);
157 path.moveTo(arrowPart2.p1());
158 path.lineTo(arrowPart2.p2());
163 : QGraphicsEllipseItem(parent)
173 visPen.setWidthF(width);
178 QGraphicsEllipseItem::paint(painter, option, widget);
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) Q_DECL_OVERRIDE
ArrowedLineItem(QGraphicsItem *parent=nullptr)
void drawArrow(const QLineF &axis, QPainterPath &path, const qreal &arrow_size)
VCurvePathItem * m_arrows
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) Q_DECL_OVERRIDE
VScaledEllipse(QGraphicsItem *parent=nullptr)
qreal GetBasicWidth() const
void setBasicWidth(const qreal &value)
VScaledLine(QGraphicsItem *parent=nullptr)
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) Q_DECL_OVERRIDE
const qreal widthMainLine
qreal sceneScale(QGraphicsScene *scene)
void scaleCircleSize(QGraphicsEllipseItem *item, qreal scale)
qreal scaleWidth(qreal width, qreal scale)