29 #ifndef VTEXTGRAPHICSITEM_H
30 #define VTEXTGRAPHICSITEM_H
33 #include <QGraphicsObject>
35 #include <QMetaObject>
44 #include "../vlayout/vtextmanager.h"
58 virtual
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
59 virtual
void Update() Q_DECL_OVERRIDE;
61 virtual
int type() const Q_DECL_OVERRIDE {
return Type;}
64 void setFont(
const QFont &font);
66 void setSize(qreal width, qreal height);
67 bool isContained(QRectF rectBB, qreal rotation, qreal &xPos, qreal &yPos)
const;
73 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
74 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
76 virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
77 virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
The VPieceLabelData class holds some information about a single piece like letter,...
The VTextGraphicsItem class. This class implements text graphics item, which can be dragged around,...
void itemRotated(qreal angle)
void UpdateBox()
VTextGraphicsItem::UpdateBox redraws the label content.
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE
VTextGraphicsItem::hoverLeaveEvent tries to restore normal mouse cursor.
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE
VTextGraphicsItem::mouseReleaseEvent handles left button mouse release events.
virtual ~VTextGraphicsItem() Q_DECL_EQ_DEFAULT
void itemResized(qreal width, int fontSize)
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE
VTextGraphicsItem::mousePressEvent handles left button mouse press events.
void allUserModifications(const QPointF &pos)
int getFontSize() const
VTextGraphicsItem::getFontSize returns the currentextLiney used text base font size.
int getTextLines() const
VTextGraphicsItem::getTextLines returns the number of lines of text to show.
void userMoveAndResize(const QPointF &pos)
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE
VTextGraphicsItem::paint redraws the item content.
void updateData(const QString &name, const VPieceLabelData &data)
VTextGraphicsItem::updateData Updates the detail label.
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE
VTextGraphicsItem::hoverMoveEvent checks if cursor has to be changed.
VTextGraphicsItem(QGraphicsItem *pParent=nullptr)
VTextGraphicsItem::VTextGraphicsItem constructor.
virtual int type() const Q_DECL_OVERRIDE
void correctLabel()
VTextGraphicsItem::UpdateFont sets the text font size, so that the entire text will just fit into the...
void setFont(const QFont &font)
VTextGraphicsItem::SetFont sets the item font.
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE
VTextGraphicsItem::mouseMoveEvent handles mouse move events.
VTextManager m_textMananger
void setSize(qreal width, qreal height)
VTextGraphicsItem::setSize Tries to set the label size to (width, height). If either of those is too ...
virtual void Update() Q_DECL_OVERRIDE
VTextGraphicsItem::Update sets the correct size and font size and redraws the label.
bool isContained(QRectF rectBB, qreal rotation, qreal &xPos, qreal &yPos) const
VTextGraphicsItem::isContained checks if the bounding box around rotated rectBB is contained in the p...
The VTextManager class this class is used to determine whether a collection of text lines can fit int...