QElectroTech 0.100.0-dev
|
#include <diagramtextitem.h>
Public Types | |
enum | { Type = UserType + 1004 } |
Signals | |
void | colorChanged (QColor color) |
void | alignmentChanged (Qt::Alignment alignment) |
void | textEdited (const QString &old_str, const QString &new_str) |
void | fontChanged (QFont font) |
Public Member Functions | |
DiagramTextItem (QGraphicsItem *=nullptr) | |
DiagramTextItem::DiagramTextItem. | |
DiagramTextItem (const QString &, QGraphicsItem *=nullptr) | |
DiagramTextItem::DiagramTextItem. | |
int | type () const override |
Diagram * | diagram () const |
DiagramTextItem::diagram. | |
virtual void | fromXml (const QDomElement &)=0 |
virtual QDomElement | toXml (QDomDocument &) const |
DiagramTextItem::toXml This method do nothing and return an empty DomElement This is used to be inherited by child class. | |
void | edit () |
Edit the text with HtmlEditor. | |
QPointF | mapMovementToScene (const QPointF &) const |
QPointF | mapMovementFromScene (const QPointF &) const |
QPointF | mapMovementToParent (const QPointF &) const |
QPointF | mapMovementFromParent (const QPointF &) const |
void | setFont (const QFont &font) |
void | setColor (const QColor &color) |
QColor | color () const |
void | setNoEditable (bool e=true) |
void | setAlignment (const Qt::Alignment &alignment) |
Qt::Alignment | alignment () const |
QRectF | frameRect () const |
DiagramTextItem::frameRect. | |
void | setHtml (const QString &text) |
void | setPlainText (const QString &text) |
bool | isHtml () const |
Public Attributes | |
bool | m_block_alignment = false |
Protected Member Functions | |
void | paint (QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override |
DiagramTextItem::paint Draw this text field. This method draws the text by calling QGraphicsTextItem::paint. If text is hovered, this method draws the bounding rect in grey. | |
void | focusInEvent (QFocusEvent *) override |
DiagramTextItem::focusInEvent. | |
void | focusOutEvent (QFocusEvent *) override |
DiagramTextItem::focusOutEvent. | |
void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override |
void | mousePressEvent (QGraphicsSceneMouseEvent *event) override |
DiagramTextItem::mousePressEvent. | |
void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) override |
DiagramTextItem::mouseMoveEvent. | |
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override |
DiagramTextItem::mouseReleaseEvent. | |
void | hoverEnterEvent (QGraphicsSceneHoverEvent *) override |
void | hoverLeaveEvent (QGraphicsSceneHoverEvent *) override |
void | hoverMoveEvent (QGraphicsSceneHoverEvent *) override |
virtual void | applyRotation (const qreal &) |
void | prepareAlignment () |
DiagramTextItem::prepareAlignment Call this function before changing the bounding rect of this text. | |
void | finishAlignment () |
DiagramTextItem::finishAlignment Call this function after changing the bounding rect of this text to set the position of this text according to the alignment property. | |
Protected Attributes | |
bool | m_mouse_hover = false |
bool | m_first_move = true |
bool | m_no_editable |
bool | m_is_html = false |
QString | m_previous_html_text |
QString | m_previous_text |
QPointF | m_mouse_to_origin_movement |
Properties | |
QColor | color |
Qt::Alignment | alignment |
QString | plainText |
QFont | font |
Private Member Functions | |
void | build () |
DiagramTextItem::build Build this item with default value. | |
Private Attributes | |
QRectF | m_alignment_rect |
Qt::Alignment | m_alignment = (Qt::AlignTop | Qt::AlignLeft) |
This class represents a selectable, movable and editable text field on a diagram.
DiagramTextItem::DiagramTextItem | ( | QGraphicsItem * | parent = nullptr | ) |
DiagramTextItem::DiagramTextItem.
parent | : parent item |
DiagramTextItem::DiagramTextItem | ( | const QString & | text, |
QGraphicsItem * | parent = nullptr |
||
) |
DiagramTextItem::DiagramTextItem.
text | : text to display |
parent | : parent item |
Qt::Alignment DiagramTextItem::alignment | ( | ) | const |
|
signal |
|
protectedvirtual |
Effectue la rotation du texte en elle-meme Pour les DiagramTextItem, la rotation s'effectue autour du point (0, 0). Cette methode peut toutefois etre redefinie dans des classes filles
angle | Angle de la rotation a effectuer |
|
private |
DiagramTextItem::build Build this item with default value.
QColor DiagramTextItem::color | ( | ) | const |
|
signal |
Diagram * DiagramTextItem::diagram | ( | ) | const |
void DiagramTextItem::edit | ( | ) |
Edit the text with HtmlEditor.
|
protected |
DiagramTextItem::finishAlignment Call this function after changing the bounding rect of this text to set the position of this text according to the alignment property.
|
overrideprotected |
DiagramTextItem::focusInEvent.
event |
|
overrideprotected |
DiagramTextItem::focusOutEvent.
event |
|
signal |
QRectF DiagramTextItem::frameRect | ( | ) | const |
|
pure virtual |
Implemented in ConductorTextItem, IndependentTextItem, and DynamicElementTextItem.
|
overrideprotected |
When mouse over element change m_mouse_hover to true (used in paint() function )
e | QGraphicsSceneHoverEvent |
|
overrideprotected |
When mouse over element leave the position change m_mouse_hover to false (used in paint() function )
e | QGraphicsSceneHoverEvent |
|
overrideprotected |
Do nothing default function .
e | QGraphicsSceneHoverEvent |
bool DiagramTextItem::isHtml | ( | ) | const |
QPointF DiagramTextItem::mapMovementFromParent | ( | const QPointF & | movement | ) | const |
Traduit en coordonnees locales un mouvement / vecteur initialement exprime en coordonnees du parent.
movement | Vecteur exprime en coordonnees du parent |
QPointF DiagramTextItem::mapMovementFromScene | ( | const QPointF & | movement | ) | const |
Traduit en coordonnees locales un mouvement / vecteur initialement exprime en coordonnees de la scene.
movement | Vecteur exprime en coordonnees de la scene |
QPointF DiagramTextItem::mapMovementToParent | ( | const QPointF & | movement | ) | const |
Traduit en coordonnees de l'item parent un mouvement / vecteur initialement exprime en coordonnees locales.
movement | Vecteur exprime en coordonnees locales |
QPointF DiagramTextItem::mapMovementToScene | ( | const QPointF & | movement | ) | const |
Traduit en coordonnees de la scene un mouvement / vecteur initialement exprime en coordonnees locales.
movement | Vecteur exprime en coordonnees locales |
|
overrideprotected |
Gere les double-clics sur ce champ de texte.
event | un QGraphicsSceneMouseEvent decrivant le double-clic |
|
overrideprotected |
|
overrideprotected |
|
overrideprotected |
|
overrideprotected |
DiagramTextItem::paint Draw this text field. This method draws the text by calling QGraphicsTextItem::paint. If text is hovered, this method draws the bounding rect in grey.
painter | : painter to use |
option | : style option |
widget | : widget that is drawn to |
|
protected |
DiagramTextItem::prepareAlignment Call this function before changing the bounding rect of this text.
void DiagramTextItem::setAlignment | ( | const Qt::Alignment & | alignment | ) |
void DiagramTextItem::setColor | ( | const QColor & | color | ) |
void DiagramTextItem::setFont | ( | const QFont & | font | ) |
void DiagramTextItem::setHtml | ( | const QString & | text | ) |
|
inline |
void DiagramTextItem::setPlainText | ( | const QString & | text | ) |
|
signal |
|
virtual |
DiagramTextItem::toXml This method do nothing and return an empty DomElement This is used to be inherited by child class.
Reimplemented in IndependentTextItem, and DynamicElementTextItem.
|
inlineoverride |
|
private |
|
private |
bool DiagramTextItem::m_block_alignment = false |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |