QElectroTech 0.100.0-dev
|
The DynamicElementTextItem class This class provide a simple text field of element who can be added or removed directly from the diagram editor. This text is created to compensate a big lack of the ElementTextItem : ElementTextItem can't be added or removed directly in the diagram editor. More...
#include <dynamicelementtextitem.h>
Public Types | |
enum | TextFrom { UserText , ElementInfo , CompositeText } |
enum | { Type = UserType + 1010 } |
Public Types inherited from DiagramTextItem | |
enum | { Type = UserType + 1004 } |
Signals | |
void | textChanged (QString text) |
void | textFromChanged (DynamicElementTextItem::TextFrom text_from) |
void | infoNameChanged (QString info) |
void | compositeTextChanged (QString text) |
void | frameChanged (bool frame) |
void | plainTextChanged () |
void | textWidthChanged (qreal width) |
void | keepVisualRotationChanged (bool keep) |
Signals inherited from DiagramTextItem | |
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 | |
int | type () const override |
DynamicElementTextItem (Element *parent_element) | |
DynamicElementTextItem::DynamicElementTextItem Constructor. | |
~DynamicElementTextItem () override | |
QDomElement | toXml (QDomDocument &dom_doc) const override |
DynamicElementTextItem::toXml Export this text to xml. | |
void | fromXml (const QDomElement &dom_elmt) override |
DynamicElementTextItem::fromXml Import this text from xml. | |
Element * | parentElement () const |
DynamicElementTextItem::ParentElement. | |
ElementTextItemGroup * | parentGroup () const |
DynamicElementTextItem::parentGroup. | |
Element * | elementUseForInfo () const |
DynamicElementTextItem::elementUseForInfo. | |
void | refreshLabelConnection () |
DynamicElementTextItem::refreshLabelConnection Refresh the connection of this text when the source of text is label, or composite text, with a variable %{label}. | |
DynamicElementTextItem::TextFrom | textFrom () const |
DynamicElementTextItem::textFrom. | |
void | setTextFrom (DynamicElementTextItem::TextFrom text_from) |
DynamicElementTextItem::setTextFrom Set the final text is created from. | |
QString | text () const |
DynamicElementTextItem::text. | |
void | setText (const QString &text) |
DynamicElementTextItem::setText Set the text of this text. | |
void | setInfoName (const QString &info_name) |
DynamicElementTextItem::setInfoName Set the information name of the parent element. | |
QString | infoName () const |
DynamicElementTextItem::infoName. | |
void | setCompositeText (const QString &text) |
DynamicElementTextItem::setCompositeText Set the composite text of this text item to text. | |
QString | compositeText () const |
DynamicElementTextItem::compositeText. | |
void | setFrame (const bool frame) |
bool | frame () const |
QUuid | uuid () const |
void | updateXref () |
DynamicElementTextItem::updateXref Create or delete the Xref according to the current properties of the project. | |
void | setPlainText (const QString &text) |
void | setTextWidth (qreal width) |
void | setXref_item (Qt::AlignmentFlag m_exHrefPos) |
void | setKeepVisualRotation (bool set) |
bool | keepVisualRotation () const |
Public Member Functions inherited from DiagramTextItem | |
DiagramTextItem (QGraphicsItem *=nullptr) | |
DiagramTextItem::DiagramTextItem. | |
DiagramTextItem (const QString &, QGraphicsItem *=nullptr) | |
DiagramTextItem::DiagramTextItem. | |
int | type () const override |
Diagram * | diagram () const |
DiagramTextItem::diagram. | |
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 |
Static Public Member Functions | |
static QMetaEnum | textFromMetaEnum () |
DynamicElementTextItem::textFromMetaEnum. | |
static QString | xmlTagName () |
Protected Member Functions | |
void | mousePressEvent (QGraphicsSceneMouseEvent *event) override |
DynamicElementTextItem::mousePressEvent. | |
void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) override |
DynamicElementTextItem::mouseMoveEvent. | |
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override |
DynamicElementTextItem::mouseReleaseEvent. | |
void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override |
DynamicElementTextItem::mouseDoubleClickEvent Reimplemented functions, for add extra feature when this text is owned by a slave. In this case if the parent slave element is linked to a master, and this text display the label of the master (both if the 'text from' is 'element info' or 'composite text') the QGraphicsView go to master and select it. | |
void | hoverEnterEvent (QGraphicsSceneHoverEvent *event) override |
DynamicElementTextItem::hoverEnterEvent If the parent element of this text is a folio report or a slave element, the element is linked and the text display the variable "label" we set the text blue for signal the user that the text act like a link when we double click on. | |
void | hoverLeaveEvent (QGraphicsSceneHoverEvent *event) override |
DynamicElementTextItem::hoverLeaveEvent. | |
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override |
QVariant | itemChange (GraphicsItemChange change, const QVariant &value) override |
bool | sceneEventFilter (QGraphicsItem *watched, QEvent *event) override |
Protected Member Functions inherited from DiagramTextItem | |
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. | |
Properties | |
QString | text |
TextFrom | textFrom |
QString | infoName |
QString | compositeText |
bool | frame |
qreal | textWidth |
bool | keepVisualRotation |
Properties inherited from DiagramTextItem | |
QColor | color |
Qt::Alignment | alignment |
QString | plainText |
QFont | font |
Private Member Functions | |
DynamicElementTextItem () | |
DynamicElementTextItem (const DynamicElementTextItem &) | |
void | elementInfoChanged () |
void | masterChanged () |
DynamicElementTextItem::masterChanged This function is only use when the parent element is a slave. Call when the master element linked to the parent slave element of this text change. | |
void | reportChanged () |
DynamicElementTextItem::reportChanged This function is only use when parent element of this text is a folio report The linked report of the parent element was changed. | |
void | reportFormulaChanged () |
DynamicElementTextItem::reportFormulaChanged The report formula use in the project was changed. | |
void | setConnectionForReportFormula (const QString &formula) |
void | removeConnectionForReportFormula (const QString &formula) |
void | setupFormulaConnection () |
DynamicElementTextItem::setupFormulaConnection Setup the required connection for the formula of the label. | |
void | clearFormulaConnection () |
void | updateReportFormulaConnection () |
void | updateReportText () |
DynamicElementTextItem::updateReportText This function is only use when this text is owned by a report, and this text have for info the Label. | |
void | updateLabel () |
DynamicElementTextItem::updateLabel Update the displayed text, when this dynamic text is based on the label of the parent element. This function is notably use when the label itself is based from a formula. If this dynamic text isn't based on label, this function do nothing. | |
void | conductorWasAdded (Conductor *conductor) |
DynamicElementTextItem::conductorWasAdded Function only use when parent element is a folio report. | |
void | conductorWasRemoved (Conductor *conductor) |
DynamicElementTextItem::conductorWasRemoved Function only use when parent element is a folio report. | |
void | setPotentialConductor () |
DynamicElementTextItem::setPotentialConductor This function is only used when the parent element of this text is a report element Get a conductor in the potential of the parent report. | |
void | conductorPropertiesChanged () |
DynamicElementTextItem::conductorPropertiesChanged This function is only used when the parent element of this text is a report element. | |
QString | reportReplacedCompositeText () const |
DynamicElementTextItem::reportReplacedCompositeText This function is only used when the parent element of this text is a report element. | |
void | zoomToLinkedElement () |
DynamicElementTextItem::zoomToLinkedElement If the parent element is a folio report or a slave element, and is linked, zoom to the linked element. | |
void | parentElementRotationChanged () |
DynamicElementTextItem::parentElementRotationChanged Called when the parent element is rotated. | |
void | thisRotationChanged () |
DynamicElementTextItem::thisRotationChanged This function is called when user change the rotation of the text and "keep visual rotation" is to true to keep in memory the visual rotation wanted by the user. | |
Private Attributes | |
QPointer< Element > | m_parent_element |
QPointer< Element > | m_master_element |
QPointer< Element > | m_other_report |
QPointer< Conductor > | m_watched_conductor |
QString | m_text |
QString | m_info_name |
QString | m_composite_text |
QString | m_report_formula |
QString | m_F_str |
DynamicElementTextItem::TextFrom | m_text_from = UserText |
QUuid | m_uuid |
QMetaObject::Connection | m_report_formula_con |
QList< QMetaObject::Connection > | m_formula_connection |
QList< QMetaObject::Connection > | m_update_slave_Xref_connection |
QColor | m_user_color |
bool | m_frame = false |
bool | m_first_scene_change = true |
CrossRefItem * | m_Xref_item = nullptr |
QGraphicsTextItem * | m_slave_Xref_item = nullptr |
qreal | m_text_width = -1 |
QPointF | m_initial_position |
bool | m_keep_visual_rotation = true |
qreal | m_visual_rotation_ref = 0 |
Friends | |
class | DynamicTextItemDelegate |
class | CompositeTextEditDialog |
class | Element |
Additional Inherited Members | |
Public Attributes inherited from DiagramTextItem | |
bool | m_block_alignment = false |
Protected Attributes inherited from DiagramTextItem | |
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 |
The DynamicElementTextItem class This class provide a simple text field of element who can be added or removed directly from the diagram editor. This text is created to compensate a big lack of the ElementTextItem : ElementTextItem can't be added or removed directly in the diagram editor.
DynamicElementTextItem::DynamicElementTextItem | ( | Element * | parent_element | ) |
DynamicElementTextItem::DynamicElementTextItem Constructor.
parent_element |
|
override |
|
private |
|
private |
|
private |
QString DynamicElementTextItem::compositeText | ( | ) | const |
|
signal |
|
private |
DynamicElementTextItem::conductorPropertiesChanged This function is only used when the parent element of this text is a report element.
|
private |
DynamicElementTextItem::conductorWasAdded Function only use when parent element is a folio report.
conductor |
|
private |
DynamicElementTextItem::conductorWasRemoved Function only use when parent element is a folio report.
conductor |
|
private |
Element * DynamicElementTextItem::elementUseForInfo | ( | ) | const |
DynamicElementTextItem::elementUseForInfo.
bool DynamicElementTextItem::frame | ( | ) | const |
|
signal |
|
overridevirtual |
DynamicElementTextItem::fromXml Import this text from xml.
dom_elmt |
Implements DiagramTextItem.
|
overrideprotected |
DynamicElementTextItem::hoverEnterEvent If the parent element of this text is a folio report or a slave element, the element is linked and the text display the variable "label" we set the text blue for signal the user that the text act like a link when we double click on.
event |
|
overrideprotected |
QString DynamicElementTextItem::infoName | ( | ) | const |
DynamicElementTextItem::infoName.
|
signal |
|
overrideprotected |
bool DynamicElementTextItem::keepVisualRotation | ( | ) | const |
|
signal |
|
private |
DynamicElementTextItem::masterChanged This function is only use when the parent element is a slave. Call when the master element linked to the parent slave element of this text change.
|
overrideprotected |
DynamicElementTextItem::mouseDoubleClickEvent Reimplemented functions, for add extra feature when this text is owned by a slave. In this case if the parent slave element is linked to a master, and this text display the label of the master (both if the 'text from' is 'element info' or 'composite text') the QGraphicsView go to master and select it.
event |
|
overrideprotected |
|
overrideprotected |
|
overrideprotected |
DynamicElementTextItem::mouseReleaseEvent.
event |
|
overrideprotected |
Element * DynamicElementTextItem::parentElement | ( | ) | const |
DynamicElementTextItem::ParentElement.
|
private |
DynamicElementTextItem::parentElementRotationChanged Called when the parent element is rotated.
ElementTextItemGroup * DynamicElementTextItem::parentGroup | ( | ) | const |
DynamicElementTextItem::parentGroup.
|
signal |
void DynamicElementTextItem::refreshLabelConnection | ( | ) |
DynamicElementTextItem::refreshLabelConnection Refresh the connection of this text when the source of text is label, or composite text, with a variable %{label}.
|
private |
|
private |
DynamicElementTextItem::reportChanged This function is only use when parent element of this text is a folio report The linked report of the parent element was changed.
|
private |
DynamicElementTextItem::reportFormulaChanged The report formula use in the project was changed.
|
private |
DynamicElementTextItem::reportReplacedCompositeText This function is only used when the parent element of this text is a report element.
|
overrideprotected |
void DynamicElementTextItem::setCompositeText | ( | const QString & | text | ) |
DynamicElementTextItem::setCompositeText Set the composite text of this text item to text.
text |
|
private |
void DynamicElementTextItem::setFrame | ( | const bool | frame | ) |
void DynamicElementTextItem::setInfoName | ( | const QString & | info_name | ) |
DynamicElementTextItem::setInfoName Set the information name of the parent element.
info_name |
void DynamicElementTextItem::setKeepVisualRotation | ( | bool | set | ) |
void DynamicElementTextItem::setPlainText | ( | const QString & | text | ) |
|
private |
DynamicElementTextItem::setPotentialConductor This function is only used when the parent element of this text is a report element Get a conductor in the potential of the parent report.
void DynamicElementTextItem::setText | ( | const QString & | text | ) |
DynamicElementTextItem::setText Set the text of this text.
text |
void DynamicElementTextItem::setTextFrom | ( | DynamicElementTextItem::TextFrom | text_from | ) |
DynamicElementTextItem::setTextFrom Set the final text is created from.
text_from |
void DynamicElementTextItem::setTextWidth | ( | qreal | width | ) |
|
private |
DynamicElementTextItem::setupFormulaConnection Setup the required connection for the formula of the label.
void DynamicElementTextItem::setXref_item | ( | Qt::AlignmentFlag | m_exHrefPos | ) |
QString DynamicElementTextItem::text | ( | ) | const |
|
signal |
DynamicElementTextItem::TextFrom DynamicElementTextItem::textFrom | ( | ) | const |
DynamicElementTextItem::textFrom.
|
signal |
|
static |
DynamicElementTextItem::textFromMetaEnum.
|
signal |
|
private |
DynamicElementTextItem::thisRotationChanged This function is called when user change the rotation of the text and "keep visual rotation" is to true to keep in memory the visual rotation wanted by the user.
|
overridevirtual |
DynamicElementTextItem::toXml Export this text to xml.
dom_doc |
Reimplemented from DiagramTextItem.
|
inlineoverride |
|
private |
DynamicElementTextItem::updateLabel Update the displayed text, when this dynamic text is based on the label of the parent element. This function is notably use when the label itself is based from a formula. If this dynamic text isn't based on label, this function do nothing.
|
private |
|
private |
DynamicElementTextItem::updateReportText This function is only use when this text is owned by a report, and this text have for info the Label.
void DynamicElementTextItem::updateXref | ( | ) |
DynamicElementTextItem::updateXref Create or delete the Xref according to the current properties of the project.
QUuid DynamicElementTextItem::uuid | ( | ) | const |
|
inlinestatic |
|
private |
DynamicElementTextItem::zoomToLinkedElement If the parent element is a folio report or a slave element, and is linked, zoom to the linked element.
|
friend |
|
friend |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |