29 #ifndef VGRAINLINEITEM_H
30 #define VGRAINLINEITEM_H
33 #include "../vpatterndb/floatItemData/vgrainlinedata.h"
34 #include "../vmisc/def.h"
43 virtual QPainterPath
shape() const Q_DECL_OVERRIDE;
45 virtual
void paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption, QWidget* pWidget) Q_DECL_OVERRIDE;
48 virtual
int type() const Q_DECL_OVERRIDE {
return Type;}
51 bool isContained(
const QPointF &pt, qreal dRot, qreal &dX, qreal &dY)
const;
58 virtual void mousePressEvent(QGraphicsSceneMouseEvent* pME) Q_DECL_OVERRIDE;
59 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* pME) Q_DECL_OVERRIDE;
61 virtual void hoverEnterEvent(QGraphicsSceneHoverEvent* pME) Q_DECL_OVERRIDE;
62 virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent* pME) Q_DECL_OVERRIDE;
63 virtual void Update() Q_DECL_OVERRIDE;
66 virtual
double GetAngle(const QPointF &pt) const Q_DECL_OVERRIDE;
68 QPointF
Rotate(const QPointF& pt, const QPointF& ptCenter, qreal dAng) const;
bool isContained(const QPointF &pt, qreal dRot, qreal &dX, qreal &dY) const
VGrainlineItem::isContained checks, if both ends of the grainline, starting at pt,...
void itemResized(qreal dLength)
void UpdateRectangle()
VGrainlineItem::UpdateRectangle updates the polygon for the box around active item and the bounding r...
void UpdateGeometry(const QPointF &ptPos, qreal dRotation, qreal dLength, ArrowType eAT)
VGrainlineItem::UpdateGeometry updates the item with grainline parameters.
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *pME) Q_DECL_OVERRIDE
VGrainlineItem::mouseReleaseEvent handles mouse release events and emits the proper signal if the ite...
void allUserModifications(const QPointF &pos)
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *pME) Q_DECL_OVERRIDE
VGrainlineItem::mouseMoveEvent handles mouse move events, making sure that the item is moved properly...
virtual void paint(QPainter *pP, const QStyleOptionGraphicsItem *pOption, QWidget *pWidget) Q_DECL_OVERRIDE
VGrainlineItem::paint paints the item content.
virtual void mousePressEvent(QGraphicsSceneMouseEvent *pME) Q_DECL_OVERRIDE
VGrainlineItem::mousePressEvent handles left button mouse press events.
QPainterPath MainShape() const
QPolygonF SecondArrow(qreal dArrLen) const
void itemRotated(qreal dRot, const QPointF &ptNewPos)
void userMoveAndResize(const QPointF &pos)
virtual void Update() Q_DECL_OVERRIDE
VGrainlineItem::Update updates the item.
QPointF GetInsideCorner(int i, qreal dDist) const
VGrainlineItem::GetInsideCorner calculates a point inside the bounding polygon, dDist away of i-th po...
qreal GetScale() const
GetScale gets the scale for keeping the arrows of constant size.
virtual ~VGrainlineItem() Q_DECL_EQ_DEFAULT
virtual QPainterPath shape() const Q_DECL_OVERRIDE
virtual int type() const Q_DECL_OVERRIDE
QPolygonF FirstArrow(qreal dArrLen) const
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *pME) Q_DECL_OVERRIDE
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *pME) Q_DECL_OVERRIDE
VGrainlineItem(QGraphicsItem *pParent=nullptr)
VGrainlineItem::VGrainlineItem constructor.
QPointF Rotate(const QPointF &pt, const QPointF &ptCenter, qreal dAng) const
VGrainlineItem::Rotate rotates point pt around ptCenter by angle dAng [rad] and returns the resulting...
virtual double GetAngle(const QPointF &pt) const Q_DECL_OVERRIDE
GetAngle calculates the angle between the line, which goes from rotation center to pt and x axis.