QElectroTech
0.70
|
#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. More... | |
DiagramTextItem (const QString &, QGraphicsItem *=nullptr) | |
DiagramTextItem::DiagramTextItem. More... | |
int | type () const override |
Diagram * | diagram () const |
DiagramTextItem::diagram. More... | |
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. More... | |
void | edit () |
Edit the text with HtmlEditor. More... | |
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. More... | |
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 draw the text by calling QGraphicsTextItem::paint. If text is hovered, this method draw the bounding rect in grey. More... | |
void | focusInEvent (QFocusEvent *) override |
DiagramTextItem::focusInEvent. More... | |
void | focusOutEvent (QFocusEvent *) override |
DiagramTextItem::focusOutEvent. More... | |
void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override |
void | mousePressEvent (QGraphicsSceneMouseEvent *event) override |
DiagramTextItem::mousePressEvent. More... | |
void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) override |
DiagramTextItem::mouseMoveEvent. More... | |
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override |
DiagramTextItem::mouseReleaseEvent. More... | |
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. More... | |
void | finishAlignment () |
DiagramTextItem::finishAlignment Call this function after changing the bouding rect of this text to set the position of this text according to the alignment property. More... | |
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. More... | |
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.
Definition at line 33 of file diagramtextitem.h.
anonymous enum |
Enumerator | |
---|---|
Type |
Definition at line 57 of file diagramtextitem.h.
DiagramTextItem::DiagramTextItem | ( | QGraphicsItem * | parent = nullptr | ) |
DiagramTextItem::DiagramTextItem.
parent | : parent item |
Definition at line 28 of file diagramtextitem.cpp.
References build().
DiagramTextItem::DiagramTextItem | ( | const QString & | text, |
QGraphicsItem * | parent = nullptr |
||
) |
DiagramTextItem::DiagramTextItem.
text | : text to display |
parent | : parent item |
Definition at line 37 of file diagramtextitem.cpp.
References build().
Qt::Alignment DiagramTextItem::alignment | ( | ) | const |
Referenced by DynamicElementTextItem::fromXml(), setAlignment(), and DynamicElementTextItem::toXml().
|
signal |
Referenced by setAlignment().
|
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 |
Definition at line 392 of file diagramtextitem.cpp.
References QET::correctAngle().
|
private |
DiagramTextItem::build Build this item with default value.
Definition at line 47 of file diagramtextitem.cpp.
References QETApp::diagramTextsItemFont(), setFont(), setNoEditable(), and QET::Icons::tr.
Referenced by DiagramTextItem().
QColor DiagramTextItem::color | ( | ) | const |
|
signal |
Referenced by setColor(), and DynamicElementTextModel::setConnection().
Diagram * DiagramTextItem::diagram | ( | ) | const |
Definition at line 63 of file diagramtextitem.cpp.
Referenced by IndependentTextItem::focusOutEvent(), mouseMoveEvent(), DynamicElementTextItem::mouseMoveEvent(), ConductorTextItem::mouseReleaseEvent(), mouseReleaseEvent(), DynamicElementTextItem::reportChanged(), DynamicElementTextItem::setPlainText(), DynamicElementTextItem::setupFormulaConnection(), and DynamicElementTextItem::updateXref().
void DiagramTextItem::edit | ( | ) |
Edit the text with HtmlEditor.
Definition at line 453 of file diagramtextitem.cpp.
References qdesigner_internal::RichTextEditorDialog::applyEditText(), setHtml(), and qdesigner_internal::RichTextEditorDialog::setText().
|
protected |
DiagramTextItem::finishAlignment Call this function after changing the bouding rect of this text to set the position of this text according to the alignment property.
Definition at line 410 of file diagramtextitem.cpp.
References m_alignment, m_alignment_rect, and m_block_alignment.
Referenced by setFont(), and DynamicElementTextItem::setPlainText().
|
overrideprotected |
DiagramTextItem::focusInEvent.
e |
Definition at line 267 of file diagramtextitem.cpp.
References m_previous_html_text, and m_previous_text.
|
overrideprotected |
DiagramTextItem::focusOutEvent.
event |
Definition at line 281 of file diagramtextitem.cpp.
References m_previous_text, and textEdited().
Referenced by IndependentTextItem::focusOutEvent().
|
signal |
QRectF DiagramTextItem::frameRect | ( | ) | const |
Definition at line 192 of file diagramtextitem.cpp.
Referenced by DynamicElementTextItem::paint().
|
pure virtual |
Implemented in DynamicElementTextItem, ConductorTextItem, and IndependentTextItem.
|
overrideprotected |
When mouse over element change m_mouse_hover to true (used in paint() function )
e | QGraphicsSceneHoverEvent |
Definition at line 472 of file diagramtextitem.cpp.
References m_mouse_hover.
Referenced by DynamicElementTextItem::hoverEnterEvent().
|
overrideprotected |
When mouse over element leave the position change m_mouse_hover to false (used in paint() function )
e | QGraphicsSceneHoverEvent |
Definition at line 486 of file diagramtextitem.cpp.
References m_mouse_hover.
Referenced by DynamicElementTextItem::hoverLeaveEvent().
|
overrideprotected |
Do nothing default function .
e | QGraphicsSceneHoverEvent |
Definition at line 496 of file diagramtextitem.cpp.
bool DiagramTextItem::isHtml | ( | ) | const |
Definition at line 224 of file diagramtextitem.cpp.
References m_is_html.
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 |
Definition at line 140 of file diagramtextitem.cpp.
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 |
Definition at line 102 of file diagramtextitem.cpp.
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 |
Definition at line 121 of file diagramtextitem.cpp.
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 |
Definition at line 83 of file diagramtextitem.cpp.
|
overrideprotected |
Gere les double-clics sur ce champ de texte.
event | un QGraphicsSceneMouseEvent decrivant le double-clic |
Definition at line 303 of file diagramtextitem.cpp.
References m_no_editable.
Referenced by DynamicElementTextItem::mouseDoubleClickEvent().
|
overrideprotected |
DiagramTextItem::mouseMoveEvent.
event |
Definition at line 334 of file diagramtextitem.cpp.
References ElementsMover::beginMovement(), ElementsMover::continueMovement(), diagram(), Diagram::elementsMover(), m_first_move, m_mouse_to_origin_movement, and Diagram::snapToGrid().
|
overrideprotected |
DiagramTextItem::mousePressEvent.
event |
Definition at line 319 of file diagramtextitem.cpp.
References m_first_move, and m_mouse_to_origin_movement.
Referenced by ConductorTextItem::mousePressEvent(), and DynamicElementTextItem::mousePressEvent().
|
overrideprotected |
DiagramTextItem::mouseReleaseEvent.
event |
Definition at line 365 of file diagramtextitem.cpp.
References diagram(), Diagram::elementsMover(), and ElementsMover::endMovement().
|
overrideprotected |
DiagramTextItem::paint Draw this text field. This method draw the text by calling QGraphicsTextItem::paint. If text is hovered, this method draw the bounding rect in grey.
painter | : painter to use |
option | : style option |
widget | : widget where must to draw |
Definition at line 236 of file diagramtextitem.cpp.
References m_mouse_hover.
Referenced by DynamicElementTextItem::paint().
|
protected |
DiagramTextItem::prepareAlignment Call this function before changing the bounding rect of this text.
Definition at line 400 of file diagramtextitem.cpp.
References m_alignment_rect.
Referenced by setFont(), and DynamicElementTextItem::setPlainText().
void DiagramTextItem::setAlignment | ( | const Qt::Alignment & | alignment | ) |
Definition at line 177 of file diagramtextitem.cpp.
References alignment(), alignmentChanged(), and m_alignment.
Referenced by DynamicElementTextItem::fromXml().
void DiagramTextItem::setColor | ( | const QColor & | color | ) |
Definition at line 167 of file diagramtextitem.cpp.
References color(), and colorChanged().
Referenced by DynamicElementTextItem::fromXml().
void DiagramTextItem::setFont | ( | const QFont & | font | ) |
Definition at line 153 of file diagramtextitem.cpp.
References finishAlignment(), font, fontChanged(), and prepareAlignment().
Referenced by build(), DynamicElementTextItem::DynamicElementTextItem(), IndependentTextItem::fromXml(), DynamicElementTextItem::fromXml(), Element::fromXml(), IndependentTextItem::IndependentTextItem(), Element::parseInput(), and Conductor::setProperties().
void DiagramTextItem::setHtml | ( | const QString & | text | ) |
Definition at line 212 of file diagramtextitem.cpp.
References m_is_html.
Referenced by edit(), IndependentTextItem::fromXml(), and ChangeDiagramTextCommand::redo().
|
inline |
Definition at line 75 of file diagramtextitem.h.
References m_no_editable.
Referenced by build(), and DynamicElementTextItem::setTextFrom().
void DiagramTextItem::setPlainText | ( | const QString & | text | ) |
Definition at line 218 of file diagramtextitem.cpp.
References m_is_html.
Referenced by Conductor::refreshText(), DynamicElementTextItem::setPlainText(), and Conductor::setProperties().
|
signal |
|
virtual |
DiagramTextItem::toXml This method do nothing and return an empty DomElement This is used to be inherited by child class.
Reimplemented in DynamicElementTextItem, and IndependentTextItem.
Definition at line 73 of file diagramtextitem.cpp.
|
inlineoverride |
Definition at line 58 of file diagramtextitem.h.
References Type.
|
private |
Definition at line 119 of file diagramtextitem.h.
Referenced by finishAlignment(), and setAlignment().
|
private |
Definition at line 118 of file diagramtextitem.h.
Referenced by finishAlignment(), and prepareAlignment().
bool DiagramTextItem::m_block_alignment = false |
Definition at line 79 of file diagramtextitem.h.
Referenced by finishAlignment().
|
protected |
Definition at line 108 of file diagramtextitem.h.
Referenced by mouseMoveEvent(), DynamicElementTextItem::mouseMoveEvent(), and mousePressEvent().
|
protected |
Definition at line 110 of file diagramtextitem.h.
Referenced by isHtml(), setHtml(), and setPlainText().
|
protected |
Definition at line 107 of file diagramtextitem.h.
Referenced by ConductorTextItem::hoverEnterEvent(), hoverEnterEvent(), ConductorTextItem::hoverLeaveEvent(), hoverLeaveEvent(), and paint().
|
protected |
Definition at line 115 of file diagramtextitem.h.
Referenced by ConductorTextItem::mouseMoveEvent(), mouseMoveEvent(), and mousePressEvent().
|
protected |
Definition at line 108 of file diagramtextitem.h.
Referenced by mouseDoubleClickEvent(), and setNoEditable().
|
protected |
Definition at line 112 of file diagramtextitem.h.
Referenced by focusInEvent(), and IndependentTextItem::focusOutEvent().
|
protected |
Definition at line 112 of file diagramtextitem.h.
Referenced by focusInEvent(), and focusOutEvent().
|
readwrite |
Definition at line 38 of file diagramtextitem.h.
Referenced by DynamicTextItemDelegate::createEditor(), DynamicElementTextModel::itemsForText(), and DynamicElementTextModel::undoForEditedText().
|
readwrite |
Definition at line 37 of file diagramtextitem.h.
Referenced by DynamicElementTextModel::itemsForText(), DynamicElementTextModel::undoForEditedText(), and DynamicElementTextModel::updateDataFromText().
|
readwrite |
Definition at line 40 of file diagramtextitem.h.
Referenced by IndependentTextItem::fromXml(), DynamicElementTextItem::fromXml(), Element::fromXml(), DynamicElementTextModel::itemsForText(), DynamicElementTextItem::paint(), Element::parseInput(), setFont(), Conductor::setProperties(), IndependentTextItem::toXml(), DynamicElementTextItem::toXml(), DynamicElementTextModel::undoForEditedText(), and DynamicElementTextModel::updateDataFromText().
|
readwrite |
Definition at line 39 of file diagramtextitem.h.