OGS
|
#include <QArrow.h>
Public Member Functions | |
QArrow (qreal l, qreal a, qreal hl, qreal hw, QPen &pen, QGraphicsItem *parent=nullptr) | |
QArrow (qreal l, qreal a, QPen &pen, QGraphicsItem *parent=nullptr) | |
~QArrow () override | |
double | getLength () |
Returns the length of the arrow. | |
double | getAngle () |
Returns the orientation of the arrow. | |
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override |
QRectF | boundingRect () const override |
The bounding box of the arrow. | |
void | setAngle (qreal a) |
Changes orientation of the arrow. | |
void | setLength (qreal l) |
Changes the length of the arrow. | |
Private Member Functions | |
double | calcCos (double angle) |
double | calcSin (double angle) |
Private Attributes | |
qreal | _arrowLength |
qreal | _arrowAngle |
qreal | _headLength |
qreal | _headWidth |
QPen | _arrowPen |
QArrow::QArrow | ( | qreal | l, |
qreal | a, | ||
qreal | hl, | ||
qreal | hw, | ||
QPen & | pen, | ||
QGraphicsItem * | parent = nullptr ) |
Creates an arrow as a QGraphicItem.
l | Length of the arrow |
a | Orientation of the arrow |
hl | Length of the arrow head |
hw | Width of the arrow head |
pen | The pen for drawing the arrow |
parent | The parent QGraphicsItem. |
Definition at line 30 of file QArrow.cpp.
References _arrowAngle, _arrowLength, _arrowPen, _headLength, and _headWidth.
QArrow::QArrow | ( | qreal | l, |
qreal | a, | ||
QPen & | pen, | ||
QGraphicsItem * | parent = nullptr ) |
Creates an arrow as a QGraphicItem. Length and width of the arrow head are given by default values.
l | Length of the arrow |
a | Orientation of the arrow |
pen | The pen for drawing the arrow |
parent | The parent QGraphicsItem. |
Definition at line 47 of file QArrow.cpp.
References _arrowAngle, _arrowLength, _arrowPen, _headLength, and _headWidth.
|
overridedefault |
|
override |
The bounding box of the arrow.
Definition at line 70 of file QArrow.cpp.
References _arrowAngle, and _arrowLength.
|
private |
|
private |
double QArrow::getAngle | ( | ) |
Returns the orientation of the arrow.
Definition at line 85 of file QArrow.cpp.
References _arrowAngle.
double QArrow::getLength | ( | ) |
|
override |
Overloaded paint-method from QGraphicsItem. Basically it draws a line with an arrowhead consisting of two short lines at the end
Definition at line 95 of file QArrow.cpp.
References _arrowAngle, _arrowLength, _arrowPen, _headLength, _headWidth, calcCos(), calcSin(), and PI.
void QArrow::setAngle | ( | qreal | a | ) |
Changes orientation of the arrow.
Definition at line 124 of file QArrow.cpp.
References _arrowAngle.
void QArrow::setLength | ( | qreal | l | ) |
Changes the length of the arrow.
Definition at line 130 of file QArrow.cpp.
References _arrowLength.
Referenced by DiagramScene::update().
|
private |
Definition at line 46 of file QArrow.h.
Referenced by QArrow(), QArrow(), boundingRect(), getAngle(), paint(), and setAngle().
|
private |
Definition at line 45 of file QArrow.h.
Referenced by QArrow(), QArrow(), boundingRect(), getLength(), paint(), and setLength().
|
private |
|
private |
|
private |